compiler/tests/PPCGuardTest.st
changeset 415 f30eb7ea54cd
parent 414 0eaf09920532
child 421 7e08b31e0dae
equal deleted inserted replaced
414:0eaf09920532 415:f30eb7ea54cd
    32 	self assert: compiler lines size = 1.
    32 	self assert: compiler lines size = 1.
    33 	self assert: compiler lines first = '(context peek isAlphaNumeric)'.
    33 	self assert: compiler lines first = '(context peek isAlphaNumeric)'.
    34 !
    34 !
    35 
    35 
    36 testCompiling3
    36 testCompiling3
    37 	guard := PPCGuard new initializeFor: ($a asParser, (#letter asParser / #digit asParser)) asCompilerTree.
    37         guard := PPCGuard new initializeFor: ($a asParser, (#letter asParser / #digit asParser)) asCompilerTree.
    38 	guard id: #foo.
    38         guard id: #foo.
    39 	guard compileGuard: compiler.
    39         guard compileGuard: compiler.
    40 	
    40         
    41 	self assert: compiler lines size = 1.
    41         self assert: compiler lines size = 1.
    42 	self assert: compiler lines first = ('(context peek = ', $a printString ,')').
    42         self assert: compiler lines first = ('(context peek = ', $a storeString ,')').
       
    43 
       
    44     "Modified: / 06-11-2014 / 00:47:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    43 !
    45 !
    44 
    46 
    45 testCompiling4
    47 testCompiling4
    46 	guard := PPCGuard new initializeFor: ('foo' asParser / 'foobar' asParser) asCompilerTree.
    48         guard := PPCGuard new initializeFor: ('foo' asParser / 'foobar' asParser) asCompilerTree.
    47 	guard id: #foo.
    49         guard id: #foo.
    48 	guard compileGuard: compiler.
    50         guard compileGuard: compiler.
    49 	
    51         
    50 	self assert: compiler lines size = 1.
    52         self assert: compiler lines size = 1.
    51 	self assert: compiler lines first = ('(context peek = ', $f printString ,')').
    53         self assert: compiler lines first = ('(context peek = ', $f storeString ,')').
       
    54 
       
    55     "Modified: / 06-11-2014 / 00:47:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    52 !
    56 !
    53 
    57 
    54 testMakesSense
    58 testMakesSense
    55 	guard := PPCGuard new initializeFor: #letter asParser.
    59 	guard := PPCGuard new initializeFor: #letter asParser.
    56 	self assert: guard makesSense.
    60 	self assert: guard makesSense.