forked from pharo-project/pharo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MicQuoteBlockTest.class.st
99 lines (93 loc) · 1.98 KB
/
MicQuoteBlockTest.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
"
I'm a test class for testing the behavior of MicBlockTextBlock
"
Class {
#name : #MicQuoteBlockTest,
#superclass : #MicBlockTest,
#category : #'Microdown-Tests'
}
{ #category : #tests }
MicQuoteBlockTest >> testContents [
| source root |
source := '> text1
> text2'.
root := parser parse: source.
self assert: root children first contents equals: '[ text1
text2 ]'
]
{ #category : #tests }
MicQuoteBlockTest >> testNotLazy [
"the spec says that the last > could be omitted but we do not support it."
| source root text |
source := '> text1
> - text2
text3'.
root := parser parse: source.
self assert: root children size equals: 2.
text := root children first.
self
assert: text text
equals:
'text1
- text2'
]
{ #category : #tests }
MicQuoteBlockTest >> testQuoteBlockDoesNotInterpretOtherBlockMarkup [
| source root text |
source := '> text1
> - text2
> ```languague=pharo
> Yeah cool'.
root := parser parse: source.
self assert: root children size equals: 1.
text := root children first.
self
assert: text text
equals:
'text1
- text2
```languague=pharo
Yeah cool'
]
{ #category : #tests }
MicQuoteBlockTest >> testShowStructure [
| source root |
source := '> text1
> text2'.
root := parser parse: source.
self assert: (root children first showStructure: 0) equals: 'MicQuoteBlock
'
]
{ #category : #tests }
MicQuoteBlockTest >> testSingleQuoteBlock [
| source root text |
source := '> text1
> text2'.
root := parser parse: source.
self assert: root children size equals: 1.
text := root children first.
self
assert: text text
equals:
'text1
text2'
]
{ #category : #tests }
MicQuoteBlockTest >> testSingleQuoteBlockFollowedByList [
| source root text list |
source := '> text1
> text2
1. first
2. second
3. third'.
root := parser parse: source.
self assert: root children size equals: 2.
text := root children first.
self
assert: text text
equals:
'text1
text2'.
list := root children second.
self assert: list children size equals: 3
]