--- a/compiler/tests/PPCNodeCompilingTest.st Tue May 05 16:25:23 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-"{ Package: 'stx:goodies/petitparser/compiler/tests' }"
-
-"{ NameSpace: Smalltalk }"
-
-PPAbstractParserTest subclass:#PPCNodeCompilingTest
- instanceVariableNames:'parser context tree result'
- classVariableNames:''
- poolDictionaries:''
- category:'PetitCompiler-Tests-Nodes'
-!
-
-
-!PPCNodeCompilingTest methodsFor:'context'!
-
-context
- ^ context := PPCProfilingContext new
-! !
-
-!PPCNodeCompilingTest methodsFor:'test support'!
-
-assert: whatever parse: input
- result := super assert: whatever parse: input.
-!
-
-compileTree: root
- ^ self compileTree: root arguments: PPCArguments default
-!
-
-compileTree: root arguments: arguments
- | configuration |
- arguments profile: true.
-
- configuration := PPCPluggableConfiguration on: [ :_self |
- _self specialize.
- _self specialize.
- _self tokenize.
- _self inline.
- _self merge.
- _self generate.
- ].
-
- ^ configuration compile: root arguments: arguments.
-!
-
-tearDown
- | class |
-
- class := (Smalltalk at: #PPGeneratedParser ifAbsent: [nil]).
- class notNil ifTrue:[
- class removeFromSystem
- ].
-! !
-
-!PPCNodeCompilingTest methodsFor:'tests - guard'!
-
-testSequenceTokenGuard
-
- tree := PPCSequenceNode new
- children: {
- 'foo' asParser trimmingToken asCompilerTree optimizeTree.
- 'bar' asParser trimmingToken asCompilerTree optimizeTree.
- }
- yourself.
- parser := self compileTree: tree.
-
- self assert: parser parse: 'foobar'.
- self assert: result first inputValue = 'foo'.
- self assert: result second inputValue = 'bar'.
-
- self assert: parser parse: ' foobar'.
- self assert: result first inputValue = 'foo'.
- self assert: result second inputValue = 'bar'.
-
- self assert: parser fail: ' foo'.
-!
-
-testTrimmingTokenGuard
-
- tree := PPCChoiceNode new
- children: {
- 'foo' asParser trimmingToken asCompilerTree optimizeTree.
- 'bar' asParser trimmingToken asCompilerTree optimizeTree
- }
- yourself.
- parser := self compileTree: tree.
-
- self assert: parser parse: 'foo'.
- self assert: result inputValue = 'foo'.
-
- self assert: parser parse: 'bar'.
- self assert: result inputValue = 'bar'.
-
- self assert: parser parse: ' foo'.
- self assert: result inputValue = 'foo'.
-
- self assert: parser parse: ' bar'.
- self assert: result inputValue = 'bar'.
-
- self assert: parser fail: 'zorg'.
- self assert: (context invocations noneSatisfy: [ :e | e beginsWith: 'token' ]).
-! !
-
-!PPCNodeCompilingTest class methodsFor:'documentation'!
-
-version_HG
-
- ^ '$Changeset: <not expanded> $'
-! !
-