PPPredicateTest.st
changeset 94 cc0b23aea2e9
parent 44 16f1a2fdc0d7
child 192 93558b60e547
equal deleted inserted replaced
93:370b064ea3b6 94:cc0b23aea2e9
    37 ! !
    37 ! !
    38 
    38 
    39 !PPPredicateTest methodsFor:'testing-chars'!
    39 !PPPredicateTest methodsFor:'testing-chars'!
    40 
    40 
    41 testBlank
    41 testBlank
    42 	| parser |
    42         | parser |
    43 	parser := #blank asParser.
    43         parser := #blank asParser.
    44 	self assertCharacterSets: parser.
    44         self assertCharacterSets: parser.
    45 	self assert: parser parse: (String with: Character space) to: Character space.
    45         self assert: parser parse: (String with: Character space) to: Character space.
    46 	self assert: parser parse: (String with: Character tab) to: Character tab.
    46         self assert: parser parse: (String with: Character tab) to: Character tab.
    47 	self assert: parser fail: ''.
    47         self assert: parser fail: ''.
    48 	self assert: parser fail: '1'.
    48         self assert: parser fail: '1'.
    49 	self assert: parser fail: (String with: Character cr)
    49         Smalltalk isSmalltalkX ifTrue:[
       
    50             self assert: parser fail: (String with: Character return)
       
    51         ] ifFalse:[
       
    52             self assert: parser fail: (String with: Character cr)
       
    53         ].
    50 !
    54 !
    51 
    55 
    52 testChar
    56 testChar
    53 	| parser |
    57 	| parser |
    54 	parser := $* asParser.
    58 	parser := $* asParser.
    59 	self assert: parser fail: '1'.
    63 	self assert: parser fail: '1'.
    60 	self assert: parser fail: 'a'
    64 	self assert: parser fail: 'a'
    61 !
    65 !
    62 
    66 
    63 testCr
    67 testCr
    64 	| parser |
    68         | parser |
    65 	parser := #cr asParser.
    69         parser := #cr asParser.
    66 	self assertCharacterSets: parser.
    70         self assertCharacterSets: parser.
    67 	self assert: parser parse: (String with: Character cr) to: Character cr
    71         Smalltalk isSmalltalkX ifTrue:[
       
    72             self assert: parser parse: (String with: Character return) to: Character return
       
    73         ] ifFalse:[
       
    74             self assert: parser parse: (String with: Character cr) to: Character cr
       
    75         ]
    68 !
    76 !
    69 
    77 
    70 testDigit
    78 testDigit
    71 	| parser |
    79 	| parser |
    72 	parser := #digit asParser.
    80 	parser := #digit asParser.
   121 	self assert: parser fail: 'A'.
   129 	self assert: parser fail: 'A'.
   122 	self assert: parser fail: '0'
   130 	self assert: parser fail: '0'
   123 !
   131 !
   124 
   132 
   125 testNewline
   133 testNewline
   126 	| parser |
   134         | parser |
   127 	parser := #newline asParser.
   135         parser := #newline asParser.
   128 	self assertCharacterSets: parser.
   136         self assertCharacterSets: parser.
   129 	self assert: parser parse: (String with: Character cr) to: Character cr.
   137         Smalltalk isSmalltalkX ifTrue:[
   130 	self assert: parser parse: (String with: Character lf) to: Character lf.
   138             self assert: parser parse: (String with: Character return) to: Character return.
   131 	self assert: parser fail: ' '
   139         ] ifFalse:[
       
   140             self assert: parser parse: (String with: Character cr) to: Character cr.
       
   141         ].
       
   142         self assert: parser parse: (String with: Character lf) to: Character lf.
       
   143         self assert: parser fail: ' '
   132 !
   144 !
   133 
   145 
   134 testPunctuation
   146 testPunctuation
   135 	| parser |
   147 	| parser |
   136 	parser := #punctuation asParser.
   148 	parser := #punctuation asParser.
   286 ! !
   298 ! !
   287 
   299 
   288 !PPPredicateTest class methodsFor:'documentation'!
   300 !PPPredicateTest class methodsFor:'documentation'!
   289 
   301 
   290 version
   302 version
   291     ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPPredicateTest.st,v 1.3 2012-05-04 22:08:04 vrany Exp $'
   303     ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPPredicateTest.st,v 1.4 2012-12-01 15:08:06 cg Exp $'
   292 !
   304 !
   293 
   305 
   294 version_CVS
   306 version_CVS
   295     ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPPredicateTest.st,v 1.3 2012-05-04 22:08:04 vrany Exp $'
   307     ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPPredicateTest.st,v 1.4 2012-12-01 15:08:06 cg Exp $'
   296 !
   308 !
   297 
   309 
   298 version_SVN
   310 version_SVN
   299     ^ '§Id: PPPredicateTest.st 5 2010-12-19 17:38:27Z kursjan §'
   311     ^ '§Id: PPPredicateTest.st 5 2010-12-19 17:38:27Z kursjan §'
   300 ! !
   312 ! !