islands/tests/PPMemoizingIslandTest.st
changeset 387 e2b2ccaa4de6
child 389 009c2e13973c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/islands/tests/PPMemoizingIslandTest.st	Wed Oct 08 00:33:44 2014 +0100
@@ -0,0 +1,39 @@
+"{ Package: 'stx:goodies/petitparser/islands/tests' }"
+
+PPIslandTest subclass:#PPMemoizingIslandTest
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitIslands-Tests'
+!
+
+PPMemoizingIslandTest comment:''
+!
+
+!PPMemoizingIslandTest class methodsFor:'as yet unclassified'!
+
+shouldInheritSelectors 
+	^ true.
+! !
+
+!PPMemoizingIslandTest methodsFor:'as yet unclassified'!
+
+islandClass
+	^ PPMemoizingIsland 
+! !
+
+!PPMemoizingIslandTest methodsFor:'testing'!
+
+testMemo
+	| parser  result1 result2 context input |
+	
+	parser := self island: ('class' asParser, self identifier, 'endclass' asParser).
+	input := 'class Foo endclass' asPetitStream.
+	
+	context := PPContext new.
+	
+	result1 :=  parser parse: input withContext: context.
+	result2 := parser parse: input withContext: context.
+	self assert: (result1 == result2 ).
+! !
+