--- a/tests/PPParserTest.st Sat Nov 01 00:34:30 2014 +0000
+++ b/tests/PPParserTest.st Mon Nov 03 09:10:56 2014 +0000
@@ -931,23 +931,21 @@
!
testPrint
- | parser |
- parser := PPParser new.
- self assert: (parser printString includesSubstring: 'PPParser').
-
- parser := PPParser named: 'choice'.
- self assert: (parser printString includesSubstring: 'PPParser(choice').
-
- parser := PPLiteralObjectParser on: $a.
- self assert: (parser printString includesSubstring: $a printString).
-
- parser := PPFailingParser message: 'error'.
- self assert: (parser printString includesSubstring: 'error').
-
- parser := PPPredicateObjectParser on: [ :c | true ] message: 'error'.
- self assert: (parser printString includesSubstring: 'error')
-
- "Modified: / 03-10-2014 / 23:43:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ | parser |
+ parser := PPParser new.
+ self assert: (parser printString includesSubstring: 'PPParser').
+
+ parser := PPParser named: 'choice'.
+ self assert: (parser printString includesSubstring: 'PPParser(choice').
+
+ parser := PPLiteralObjectParser on: $a.
+ self assert: (parser printString includesSubstring: $a printString).
+
+ parser := PPFailingParser message: 'error'.
+ self assert: (parser printString includesSubstring: 'error').
+
+ parser := PPPredicateObjectParser on: [ :c | true ] message: 'error'.
+ self assert: (parser printString includesSubstring: 'error')
! !
!PPParserTest methodsFor:'testing-fixtures'!
@@ -1454,20 +1452,18 @@
!
testParse
- | parser result |
- parser := $a asParser.
- self assert: (parser parse: 'a') equals: $a.
- self assert: (result := parser parse: 'b') isPetitFailure.
- self assert: (result message includesSubstring: $a printString).
- self assert: (result message includesSubstring: 'expected').
- self assert: result position equals: 0.
- self assert: (parser parse: 'a' readStream) equals: $a.
- self assert: (result := parser parse: 'b' readStream) isPetitFailure.
- self assert: (result message includesSubstring: $a printString).
- self assert: (result message includesSubstring: 'expected').
- self assert: result position equals: 0
-
- "Modified: / 03-10-2014 / 23:42:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ | parser result |
+ parser := $a asParser.
+ self assert: (parser parse: 'a') equals: $a.
+ self assert: (result := parser parse: 'b') isPetitFailure.
+ self assert: (result message includesSubstring: $a printString).
+ self assert: (result message includesSubstring: 'expected').
+ self assert: result position equals: 0.
+ self assert: (parser parse: 'a' readStream) equals: $a.
+ self assert: (result := parser parse: 'b' readStream) isPetitFailure.
+ self assert: (result message includesSubstring: $a printString).
+ self assert: (result message includesSubstring: 'expected').
+ self assert: result position equals: 0
!
testParseOnError0
@@ -1481,39 +1477,35 @@
!
testParseOnError1
- | parser result seen |
- parser := $a asParser.
- result := parser parse: 'a' onError: [ self signalFailure: 'Not supposed to report an error' ].
- self assert: result equals: $a.
- result := parser
- parse: 'b'
- onError: [ :failure |
- self assert: failure position equals: 0.
- self assert: (failure message includesSubstring: $a printString).
- self assert: (failure message includesSubstring: 'expected').
- seen := true ].
- self assert: result.
- self assert: seen
-
- "Modified: / 03-10-2014 / 23:42:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ | parser result seen |
+ parser := $a asParser.
+ result := parser parse: 'a' onError: [ self signalFailure: 'Not supposed to report an error' ].
+ self assert: result equals: $a.
+ result := parser
+ parse: 'b'
+ onError: [ :failure |
+ self assert: failure position equals: 0.
+ self assert: (failure message includesSubstring: $a printString).
+ self assert: (failure message includesSubstring: 'expected').
+ seen := true ].
+ self assert: result.
+ self assert: seen
!
testParseOnError2
- | parser result seen |
- parser := $a asParser.
- result := parser parse: 'a' onError: [ self signalFailure: 'Not supposed to report an error' ].
- self assert: result equals: $a.
- result := parser
- parse: 'b'
- onError: [ :msg :pos |
- self assert: (msg includesSubstring: $a printString).
- self assert: (msg includesSubstring: 'expected').
- self assert: pos equals: 0.
- seen := true ].
- self assert: result.
- self assert: seen
-
- "Modified: / 03-10-2014 / 23:42:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ | parser result seen |
+ parser := $a asParser.
+ result := parser parse: 'a' onError: [ self signalFailure: 'Not supposed to report an error' ].
+ self assert: result equals: $a.
+ result := parser
+ parse: 'b'
+ onError: [ :msg :pos |
+ self assert: (msg includesSubstring: $a printString).
+ self assert: (msg includesSubstring: 'expected').
+ self assert: pos equals: 0.
+ seen := true ].
+ self assert: result.
+ self assert: seen
!
testParser