islands/tests/PPMemoizingIslandTest.st
changeset 387 e2b2ccaa4de6
child 389 009c2e13973c
equal deleted inserted replaced
386:a409905f7f2d 387:e2b2ccaa4de6
       
     1 "{ Package: 'stx:goodies/petitparser/islands/tests' }"
       
     2 
       
     3 PPIslandTest subclass:#PPMemoizingIslandTest
       
     4 	instanceVariableNames:''
       
     5 	classVariableNames:''
       
     6 	poolDictionaries:''
       
     7 	category:'PetitIslands-Tests'
       
     8 !
       
     9 
       
    10 PPMemoizingIslandTest comment:''
       
    11 !
       
    12 
       
    13 !PPMemoizingIslandTest class methodsFor:'as yet unclassified'!
       
    14 
       
    15 shouldInheritSelectors 
       
    16 	^ true.
       
    17 ! !
       
    18 
       
    19 !PPMemoizingIslandTest methodsFor:'as yet unclassified'!
       
    20 
       
    21 islandClass
       
    22 	^ PPMemoizingIsland 
       
    23 ! !
       
    24 
       
    25 !PPMemoizingIslandTest methodsFor:'testing'!
       
    26 
       
    27 testMemo
       
    28 	| parser  result1 result2 context input |
       
    29 	
       
    30 	parser := self island: ('class' asParser, self identifier, 'endclass' asParser).
       
    31 	input := 'class Foo endclass' asPetitStream.
       
    32 	
       
    33 	context := PPContext new.
       
    34 	
       
    35 	result1 :=  parser parse: input withContext: context.
       
    36 	result2 := parser parse: input withContext: context.
       
    37 	self assert: (result1 == result2 ).
       
    38 ! !
       
    39