# HG changeset patch # User Jan Vrany # Date 1434434054 -3600 # Node ID a836cbc0d8df666b430f57237654f43b745b6bd4 # Parent 0ca7a70db0f5ff9be317beb4bda1865f1bccf8b0 Oops, renamed testMappedNode3/4/5 to testActionNode3/4/5 which is the correct name! diff -r 0ca7a70db0f5 -r a836cbc0d8df compiler/tests/PPCCodeGeneratorTest.st --- a/compiler/tests/PPCCodeGeneratorTest.st Tue Jun 16 06:45:26 2015 +0100 +++ b/compiler/tests/PPCCodeGeneratorTest.st Tue Jun 16 06:54:14 2015 +0100 @@ -90,6 +90,45 @@ "Created: / 15-06-2015 / 13:57:36 / Jan Vrany " ! +testActionNode3 + node := ((#letter asParser , #letter asParser) + ==> [:nodes | String with:(nodes first) with:(nodes second) ]) asCompilerTree. + node child markForInline. + + self compileTree:node. + + self assert:parser parse:'ab' to:'ab'. + self assert:parser parse:'cz' to:'cz'. + self assert:parser fail:''. + + "Created: / 16-06-2015 / 06:53:17 / Jan Vrany " +! + +testActionNode4 + node := ((#letter asParser , #letter asParser) + ==> [:nodes | String with:(nodes first) with:(nodes second) ]) asCompilerTree. + node child markForInline. + + self compileTree:node. + + self assert:parser fail:'a'. + + "Created: / 16-06-2015 / 06:53:09 / Jan Vrany " +! + +testActionNode5 + node := ((#letter asParser , #letter asParser optional) + ==> [:nodes | String with:(nodes first) with:((nodes second) isNil ifTrue:[$?] ifFalse:[nodes second]) ]) asCompilerTree. + node child markForInline. + + self compileTree:node. + + self assert:parser parse:'cz' to:'cz'. + self assert:parser parse:'c' to:'c?'. + + "Created: / 16-06-2015 / 06:53:03 / Jan Vrany " +! + testAnyNode node := PPCForwardNode new child: PPCAnyNode new; @@ -488,45 +527,6 @@ "Created: / 15-06-2015 / 18:27:18 / Jan Vrany " ! -testMappedNode3 - node := ((#letter asParser , #letter asParser) - ==> [:nodes | String with:(nodes first) with:(nodes second) ]) asCompilerTree. - node child markForInline. - - self compileTree:node. - - self assert:parser parse:'ab' to:'ab'. - self assert:parser parse:'cz' to:'cz'. - self assert:parser fail:''. - - "Created: / 16-06-2015 / 06:01:53 / Jan Vrany " -! - -testMappedNode4 - node := ((#letter asParser , #letter asParser) - ==> [:nodes | String with:(nodes first) with:(nodes second) ]) asCompilerTree. - node child markForInline. - - self compileTree:node. - - self assert:parser fail:'a'. - - "Created: / 16-06-2015 / 06:13:37 / Jan Vrany " -! - -testMappedNode5 - node := ((#letter asParser , #letter asParser optional) - ==> [:nodes | String with:(nodes first) with:((nodes second) isNil ifTrue:[$?] ifFalse:[nodes second]) ]) asCompilerTree. - node child markForInline. - - self compileTree:node. - - self assert:parser parse:'cz' to:'cz'. - self assert:parser parse:'c' to:'c?'. - - "Created: / 16-06-2015 / 06:32:24 / Jan Vrany " -! - testMessagePredicate | messageNode | messageNode := PPCMessagePredicateNode new