--- a/compiler/tests/PPCGuardTest.st Wed Nov 19 10:52:37 2014 +0000
+++ b/compiler/tests/PPCGuardTest.st Mon Nov 24 00:09:23 2014 +0000
@@ -34,25 +34,35 @@
!
testCompiling3
- guard := PPCGuard new initializeFor: ($a asParser, (#letter asParser / #digit asParser)) asCompilerTree.
- guard id: #foo.
- guard compileGuard: compiler.
-
- self assert: compiler lines size = 1.
- self assert: compiler lines first = ('(context peek = ', $a storeString ,')').
-
- "Modified: / 06-11-2014 / 00:47:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ guard := PPCGuard new initializeFor: ($a asParser, (#letter asParser / #digit asParser)) asCompilerTree.
+ guard id: #foo.
+ guard compileGuard: compiler.
+
+ self assert: compiler lines size = 1.
+ self assert: compiler lines first = ('(context peek = ', $a storeString ,')').
!
testCompiling4
- guard := PPCGuard new initializeFor: ('foo' asParser / 'foobar' asParser) asCompilerTree.
- guard id: #foo.
- guard compileGuard: compiler.
-
- self assert: compiler lines size = 1.
- self assert: compiler lines first = ('(context peek = ', $f storeString ,')').
+ guard := PPCGuard new initializeFor: ('foo' asParser / 'foobar' asParser) asCompilerTree.
+ guard id: #foo.
+ guard compileGuard: compiler.
+
+ self assert: compiler lines size = 1.
+ self assert: compiler lines first = ('(context peek = ', $f storeString ,')').
+!
- "Modified: / 06-11-2014 / 00:47:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+testIdentifierToken
+ | id parser |
+ id := (#letter asParser plus)
+ name: 'identifier';
+ yourself.
+
+ parser := id smalltalkToken.
+ parser name: 'kw'.
+
+ guard := PPCGuard new initializeFor: parser asCompilerTree optimizeTree.
+ self assert: (guard classification at: $a asInteger).
+ self assert: (guard classification at: $z asInteger).
!
testMakesSense
@@ -106,6 +116,11 @@
self assert: (guard classification at: $f asInteger).
!
+testNot3
+ guard := PPCGuard new initializeFor: (#letter asParser negate star, #letter asParser) asCompilerTree optimizeTree.
+ self assert: (guard classification allSatisfy: [ :e | e]).
+!
+
testTestMessage
guard := PPCGuard new initializeFor: #letter asParser asCompilerTree.
self assert: (guard testMessage: #isLetter).