39 lines
767 B
Smalltalk
39 lines
767 B
Smalltalk
|
Class {
|
||
|
#name : #PPReplaceParserTest,
|
||
|
#superclass : #PPParserTest,
|
||
|
#instVars : [
|
||
|
'parser'
|
||
|
],
|
||
|
#category : #'PetitMarkdown-Tests'
|
||
|
}
|
||
|
|
||
|
{ #category : #'as yet unclassified' }
|
||
|
PPReplaceParserTest >> test1 [
|
||
|
| foo literal1 literal2 |
|
||
|
literal1 := 'foo' asParser.
|
||
|
literal2 := 'bar' asParser.
|
||
|
|
||
|
foo := PPDelegateParser new
|
||
|
setParser: literal1;
|
||
|
yourself.
|
||
|
|
||
|
parser := foo wrapped where: foo is: literal2.
|
||
|
|
||
|
self assert: parser parse: 'bar'.
|
||
|
]
|
||
|
|
||
|
{ #category : #'as yet unclassified' }
|
||
|
PPReplaceParserTest >> test2 [
|
||
|
| foo literal1 literal2 |
|
||
|
literal1 := 'foo' asParser.
|
||
|
literal2 := 'bar' asParser.
|
||
|
|
||
|
foo := PPDelegateParser new
|
||
|
setParser: literal1;
|
||
|
yourself.
|
||
|
|
||
|
parser := (foo wrapped where: foo is: literal2), foo.
|
||
|
|
||
|
self assert: parser parse: 'barfoo'.
|
||
|
]
|