compiler/tests/PPCGuardTest.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 05 Nov 2014 23:05:19 +0000
changeset 414 0eaf09920532
parent 401 538267cab6ec
child 415 f30eb7ea54cd
permissions -rw-r--r--
Merged JK's work on PetitCompiler Name: PetitCompiler-JanKurs.57 Author: JanKurs Time: 05-11-2014, 05:10:47 AM UUID: 4c625efe-77fd-465d-bd63-72ead0b5d3ba Name: PetitCompiler-Tests-JanVrany.13 Author: JanVrany Time: 05-11-2014, 09:31:07 AM UUID: 189ae287-6bc1-40ba-8458-b8392c4260a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
391
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"{ Package: 'stx:goodies/petitparser/compiler/tests' }"
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
TestCase subclass:#PPCGuardTest
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
	instanceVariableNames:'guard compiler'
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
	classVariableNames:''
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
	poolDictionaries:''
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
	category:'PetitCompiler-Tests-Core'
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
!
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
401
538267cab6ec Portability fix: do not use Behaviour>>methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 392
diff changeset
    10
391
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
!PPCGuardTest methodsFor:'as yet unclassified'!
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
setUp
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
	super setUp.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
	compiler := PPCMockCompiler new.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
!
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
testCompiling
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
	guard := PPCGuard new initializeFor: ($a asParser / $b asParser) asCompilerTree.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
	guard id: #foo.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
	guard compileGuard: compiler.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
	
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
	self assert: compiler lines size = 1.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
	self assert: compiler lines first = '(foo at: context peek asInteger)'.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
!
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
testCompiling2
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
	guard := PPCGuard new initializeFor: (#letter asParser / #digit asParser) asCompilerTree.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
	guard id: #foo.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
	guard compileGuard: compiler.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
	
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
	self assert: compiler lines size = 1.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
	self assert: compiler lines first = '(context peek isAlphaNumeric)'.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
!
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
testCompiling3
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
	guard := PPCGuard new initializeFor: ($a asParser, (#letter asParser / #digit asParser)) asCompilerTree.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
	guard id: #foo.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
	guard compileGuard: compiler.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
	
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
	self assert: compiler lines size = 1.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
	self assert: compiler lines first = ('(context peek = ', $a printString ,')').
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
!
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    44
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
testCompiling4
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
	guard := PPCGuard new initializeFor: ('foo' asParser / 'foobar' asParser) asCompilerTree.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
	guard id: #foo.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
	guard compileGuard: compiler.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
	
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
	self assert: compiler lines size = 1.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
	self assert: compiler lines first = ('(context peek = ', $f printString ,')').
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
!
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
testMakesSense
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
	guard := PPCGuard new initializeFor: #letter asParser.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
	self assert: guard makesSense.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
	
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
	guard := PPCGuard new initializeFor: nil asParser asCompilerTree.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
	self assert: guard makesSense not.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
	
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
	guard := PPCGuard new initializeFor: (#letter asParser / nil asParser) asCompilerTree.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
	self assert: guard makesSense not.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
	
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
	guard := PPCGuard new initializeFor: (#letter asParser / #digit asParser) asCompilerTree.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
	self assert: guard makesSense.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
	guard := PPCGuard new initializeFor: (#letter asParser / #digit asParser star) asCompilerTree.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
	self assert: guard makesSense not.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
!
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
testMessage
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    72
	guard := PPCGuard new initializeFor: #letter asParser asCompilerTree.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
	self assert: (guard message = #isLetter).
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
	self assert: (guard message = #isAlphaNumeric) not.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
	
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
	guard := PPCGuard new initializeFor: #word asParser asCompilerTree.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
	self assert: (guard message = #isAlphaNumeric).
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
	
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
	guard := PPCGuard new initializeFor: #digit asParser asCompilerTree.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
	self assert: (guard message = #isDigit).
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
	
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
	guard := PPCGuard new initializeFor: 'a' asParser asCompilerTree.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
	self assert: (guard message = #isDigit) not.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
	self assert: (guard message = #isLetter) not.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
	self assert: (guard message = #isAlphaNumeric) not.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
	
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
!
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
testMessage2
414
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
    90
	guard := PPCGuard new initializeFor: (#letter asParser / #digit asParser) asCompilerTree.
391
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    91
	self assert: guard message = #isAlphaNumeric
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
	
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
!
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    94
414
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
    95
testNot
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
    96
	guard := PPCGuard new initializeFor: ('foo' asParser not, 'fee' asParser) asCompilerTree.
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
    97
	self assert: (guard classification at: $f asInteger).
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
    98
!
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
    99
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
   100
testNot2
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
   101
	guard := PPCGuard new initializeFor: ('foo' asParser not, 'fee' asParser) asCompilerTree optimizeTree.
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
   102
	self assert: (guard classification at: $f asInteger).
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
   103
!
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
   104
391
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   105
testTestMessage
414
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
   106
	guard := PPCGuard new initializeFor: #letter asParser asCompilerTree.
391
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   107
	self assert: (guard testMessage: #isLetter).
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   108
	self assert: (guard testMessage: #isAlphaNumeric) not.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   109
	
414
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
   110
	guard := PPCGuard new initializeFor: #word asParser asCompilerTree.
391
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   111
	self assert: (guard testMessage: #isAlphaNumeric).
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   112
	
414
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
   113
	guard := PPCGuard new initializeFor: #digit asParser asCompilerTree.
391
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   114
	self assert: (guard testMessage: #isDigit).
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   115
	
414
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
   116
	guard := PPCGuard new initializeFor: 'a' asParser asCompilerTree.
391
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   117
	self assert: (guard testMessage: #isDigit) not.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   118
	self assert: (guard testMessage: #isLetter) not.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   119
	self assert: (guard testMessage: #isAlphaNumeric) not.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   120
	
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   121
!
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   122
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   123
testTestSingleCharacter
414
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
   124
	guard := PPCGuard new initializeFor: $a asParser asCompilerTree.
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
   125
	self assert: guard testSingleCharacter.
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
   126
	
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
   127
	guard := PPCGuard new initializeFor: 'foo' asParser asCompilerTree.
391
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   128
	self assert: guard testSingleCharacter.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   129
	
414
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
   130
	guard := PPCGuard new initializeFor: ('foo' asParser / 'bar' asParser) asCompilerTree.
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
   131
	self assert: guard testSingleCharacter not.
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
   132
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
   133
	guard := PPCGuard new initializeFor: ($a asParser, (#letter asParser / #digit asParser)) asCompilerTree.
391
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   134
	self assert: guard testSingleCharacter.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   135
	
414
0eaf09920532 Merged JK's work on PetitCompiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 401
diff changeset
   136
	guard := PPCGuard new initializeFor: ('foo' asParser / 'fee' asParser) asCompilerTree.
391
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   137
	self assert: guard testSingleCharacter.
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   138
! !
553a5456963b Ported PetitCompiler-(Tests).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   139
401
538267cab6ec Portability fix: do not use Behaviour>>methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 392
diff changeset
   140
!PPCGuardTest class methodsFor:'documentation'!
538267cab6ec Portability fix: do not use Behaviour>>methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 392
diff changeset
   141
538267cab6ec Portability fix: do not use Behaviour>>methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 392
diff changeset
   142
version_HG
538267cab6ec Portability fix: do not use Behaviour>>methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 392
diff changeset
   143
538267cab6ec Portability fix: do not use Behaviour>>methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 392
diff changeset
   144
    ^ '$Changeset: <not expanded> $'
538267cab6ec Portability fix: do not use Behaviour>>methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 392
diff changeset
   145
! !
538267cab6ec Portability fix: do not use Behaviour>>methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 392
diff changeset
   146