--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/PPCompositeParserTest.st Thu Aug 18 20:56:17 2011 +0200
@@ -0,0 +1,90 @@
+"{ Package: 'squeak:petitparser' }"
+
+PPAbstractParseTest subclass:#PPCompositeParserTest
+ instanceVariableNames:'parser result'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'PetitTests-Core'
+!
+
+
+!PPCompositeParserTest class methodsFor:'accessing'!
+
+resources
+ ^ Array with: PPParserResource
+! !
+
+!PPCompositeParserTest class methodsFor:'testing'!
+
+isAbstract
+ ^ self name = #PPCompositeParserTest
+! !
+
+!PPCompositeParserTest methodsFor:'accessing'!
+
+parserClass
+ self subclassResponsibility
+!
+
+parserInstance
+ ^ PPParserResource current parserAt: self parserClass
+! !
+
+!PPCompositeParserTest methodsFor:'parsing'!
+
+fail: aString rule: aSymbol
+ | production |
+ production := self parserInstance
+ productionAt: aSymbol.
+ result := production end
+ parse: aString.
+ self
+ assert: result isPetitFailure
+ description: 'Able to parse ' , aString printString.
+ ^ result
+!
+
+parse: aString
+ ^ self parse: aString rule: #start
+!
+
+parse: aString rule: aSymbol
+ | production |
+ production := self parserInstance.
+ aSymbol = #start
+ ifFalse: [ production := production productionAt: aSymbol ].
+ result := production parse: aString.
+ self
+ deny: result isPetitFailure
+ description: 'Unable to parse ' , aString printString
+ resumable: true.
+ ^ result
+! !
+
+!PPCompositeParserTest methodsFor:'running'!
+
+setUp
+ super setUp.
+ parser := self parserInstance
+!
+
+tearDown
+ super tearDown.
+ parser := result := nil
+! !
+
+!PPCompositeParserTest methodsFor:'utilities'!
+
+assert: aCollection is: anObject
+ self parse: aCollection.
+ self
+ assert: result = anObject
+ description: 'Got: ' , result printString , '; Expected: ' , anObject printString
+ resumable: true
+! !
+
+!PPCompositeParserTest class methodsFor:'documentation'!
+
+version_SVN
+ ^ '$Id: PPCompositeParserTest.st,v 1.1 2011-08-18 18:56:17 cg Exp $'
+! !