diff -r 5389e6fbb3bc -r 0eaf09920532 compiler/tests/PPCGuardTest.st --- a/compiler/tests/PPCGuardTest.st Wed Nov 05 21:40:01 2014 +0000 +++ b/compiler/tests/PPCGuardTest.st Wed Nov 05 23:05:19 2014 +0000 @@ -87,23 +87,33 @@ ! testMessage2 - guard := PPCGuard new initializeFor: #letter asParser / #digit asParser. + guard := PPCGuard new initializeFor: (#letter asParser / #digit asParser) asCompilerTree. self assert: guard message = #isAlphaNumeric ! +testNot + guard := PPCGuard new initializeFor: ('foo' asParser not, 'fee' asParser) asCompilerTree. + self assert: (guard classification at: $f asInteger). +! + +testNot2 + guard := PPCGuard new initializeFor: ('foo' asParser not, 'fee' asParser) asCompilerTree optimizeTree. + self assert: (guard classification at: $f asInteger). +! + testTestMessage - guard := PPCGuard new initializeFor: #letter asParser. + guard := PPCGuard new initializeFor: #letter asParser asCompilerTree. self assert: (guard testMessage: #isLetter). self assert: (guard testMessage: #isAlphaNumeric) not. - guard := PPCGuard new initializeFor: #word asParser. + guard := PPCGuard new initializeFor: #word asParser asCompilerTree. self assert: (guard testMessage: #isAlphaNumeric). - guard := PPCGuard new initializeFor: #digit asParser. + guard := PPCGuard new initializeFor: #digit asParser asCompilerTree. self assert: (guard testMessage: #isDigit). - guard := PPCGuard new initializeFor: 'a' asParser. + guard := PPCGuard new initializeFor: 'a' asParser asCompilerTree. self assert: (guard testMessage: #isDigit) not. self assert: (guard testMessage: #isLetter) not. self assert: (guard testMessage: #isAlphaNumeric) not. @@ -111,16 +121,19 @@ ! testTestSingleCharacter - guard := PPCGuard new initializeFor: $a asParser. + guard := PPCGuard new initializeFor: $a asParser asCompilerTree. + self assert: guard testSingleCharacter. + + guard := PPCGuard new initializeFor: 'foo' asParser asCompilerTree. self assert: guard testSingleCharacter. - guard := PPCGuard new initializeFor: 'foo' asParser. + guard := PPCGuard new initializeFor: ('foo' asParser / 'bar' asParser) asCompilerTree. + self assert: guard testSingleCharacter not. + + guard := PPCGuard new initializeFor: ($a asParser, (#letter asParser / #digit asParser)) asCompilerTree. self assert: guard testSingleCharacter. - guard := PPCGuard new initializeFor: ('foo' asParser / 'bar' asParser). - self assert: guard testSingleCharacter not. - - guard := PPCGuard new initializeFor: ($a asParser, (#letter asParser / #digit asParser)). + guard := PPCGuard new initializeFor: ('foo' asParser / 'fee' asParser) asCompilerTree. self assert: guard testSingleCharacter. ! !