Skip to content

Commit b3c780b

Browse files
committed
Cleaning all the tests of MicParagraphLabelCheckerTest
1 parent 928ca7e commit b3c780b

8 files changed

+239
-184
lines changed

src/Microdown-Rules/MicLastPeriodChecker.class.st

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Class {
1414
#name : 'MicLastPeriodChecker',
1515
#superclass : 'MicChecker',
1616
#instVars : [
17-
'codeShouldEndWithPeriod'
17+
'isEndingWithPeriod'
1818
],
1919
#category : 'Microdown-Rules-CodeLastPeriod',
2020
#package : 'Microdown-Rules',
@@ -33,7 +33,7 @@ MicLastPeriodChecker >> checkExtraPeriodIn: aMicCodeBlock [
3333
ifTrue: [ results add: (MicPeriodInCodeResult new
3434
micElement: aMicCodeBlock;
3535
inFile: aMicCodeBlock fromFile;
36-
codeShouldEndWithPeriod: codeShouldEndWithPeriod
36+
codeShouldEndWithPeriod: isEndingWithPeriod
3737
) ]
3838

3939
]
@@ -45,37 +45,38 @@ MicLastPeriodChecker >> checkMissingPeriodIn: aMicCodeBlock [
4545
results add: (MicPeriodInCodeResult new
4646
micElement: aMicCodeBlock;
4747
inFile: aMicCodeBlock fromFile;
48-
codeShouldEndWithPeriod: codeShouldEndWithPeriod) ]
48+
codeShouldEndWithPeriod: isEndingWithPeriod) ]
4949
]
5050

51-
{ #category : 'accessing' }
52-
MicLastPeriodChecker >> codeShouldEndWithPeriod [
51+
{ #category : 'visiting' }
52+
MicLastPeriodChecker >> configureFrom: aConfigurationValue [
5353

54-
^ codeShouldEndWithPeriod
54+
aConfigurationValue isNil ifTrue: [ isEndingWithPeriod := false. ^ self ].
55+
aConfigurationValue = 'true'
56+
ifTrue: [ isEndingWithPeriod := true ]
57+
ifFalse: [ isEndingWithPeriod := false ]
5558
]
5659

5760
{ #category : 'visiting' }
58-
MicLastPeriodChecker >> configureFrom: aConfigurationValue [
59-
aConfigurationValue isNil ifTrue: [ codeShouldEndWithPeriod := false. ^ self ].
60-
aConfigurationValue = 'true'
61-
ifTrue: [ codeShouldEndWithPeriod := true ]
62-
ifFalse: [ codeShouldEndWithPeriod := false ]
61+
MicLastPeriodChecker >> initialize [
62+
super initialize.
63+
isEndingWithPeriod := true
6364
]
6465

6566
{ #category : 'visiting' }
66-
MicLastPeriodChecker >> identifyExtraLastPeriod [
67+
MicLastPeriodChecker >> isEndingWithPeriod [
6768

68-
codeShouldEndWithPeriod := false
69+
^ isEndingWithPeriod
6970
]
7071

7172
{ #category : 'visiting' }
72-
MicLastPeriodChecker >> identifyMissingLastPeriod [
73+
MicLastPeriodChecker >> shouldEndWithPeriod [
7374

74-
codeShouldEndWithPeriod := true
75+
isEndingWithPeriod := true
7576
]
7677

7778
{ #category : 'visiting' }
78-
MicLastPeriodChecker >> initialize [
79-
super initialize.
80-
codeShouldEndWithPeriod := true
79+
MicLastPeriodChecker >> shouldNotEndWithPeriod [
80+
81+
isEndingWithPeriod := false
8182
]

src/Microdown-Rules/MicLastPeriodInCaptionChecker.class.st

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ MicLastPeriodInCaptionChecker >> checkExtraPeriodInCode: aCode [
4545
results add: (MicPeriodInCaptionResult new
4646
micElement: aCode;
4747
inFile: aCode fromFile;
48-
codeShouldEndWithPeriod: codeShouldEndWithPeriod) ]
48+
codeShouldEndWithPeriod: isEndingWithPeriod) ]
4949
]
5050

5151
{ #category : 'visiting - inline elements' }
@@ -56,7 +56,7 @@ MicLastPeriodInCaptionChecker >> checkExtraPeriodInFigure: aFigure [
5656
results add: (MicPeriodInCaptionResult new
5757
micElement: aFigure;
5858
inFile: aFigure fromFile;
59-
codeShouldEndWithPeriod: codeShouldEndWithPeriod) ]
59+
codeShouldEndWithPeriod: isEndingWithPeriod) ]
6060
]
6161

6262
{ #category : 'visiting - inline elements' }
@@ -70,7 +70,7 @@ MicLastPeriodInCaptionChecker >> checkExtraPeriodInMath: aMath [
7070
results add: (MicPeriodInCaptionResult new
7171
micElement: aMath;
7272
inFile: aMath fromFile;
73-
codeShouldEndWithPeriod: codeShouldEndWithPeriod) ]
73+
codeShouldEndWithPeriod: isEndingWithPeriod) ]
7474
]
7575

7676
{ #category : 'visiting - inline elements' }
@@ -84,7 +84,7 @@ MicLastPeriodInCaptionChecker >> checkMissingPeriodInCode: aCode [
8484
results add: (MicPeriodInCaptionResult new
8585
micElement: aCode;
8686
inFile: aCode fromFile;
87-
codeShouldEndWithPeriod: codeShouldEndWithPeriod) ]
87+
codeShouldEndWithPeriod: isEndingWithPeriod) ]
8888
]
8989

9090
{ #category : 'visiting - inline elements' }
@@ -94,7 +94,7 @@ MicLastPeriodInCaptionChecker >> checkMissingPeriodInFigure: aFigure [
9494
results add: (MicPeriodInCaptionResult new
9595
micElement: aFigure;
9696
inFile: aFigure fromFile;
97-
codeShouldEndWithPeriod: codeShouldEndWithPeriod) ]
97+
codeShouldEndWithPeriod: isEndingWithPeriod) ]
9898
]
9999

100100
{ #category : 'visiting - inline elements' }
@@ -109,7 +109,7 @@ MicLastPeriodInCaptionChecker >> checkMissingPeriodInMath: aMath [
109109
results add: (MicPeriodInCaptionResult new
110110
micElement: aMath;
111111
inFile: aMath fromFile;
112-
codeShouldEndWithPeriod: codeShouldEndWithPeriod) ]
112+
codeShouldEndWithPeriod: isEndingWithPeriod) ]
113113
]
114114

115115
{ #category : 'helpers' }
@@ -124,15 +124,15 @@ MicLastPeriodInCaptionChecker >> visitCode: anEquation [
124124

125125
"this way we could share the same logic between all the elements."
126126

127-
codeShouldEndWithPeriod
127+
isEndingWithPeriod
128128
ifTrue: [ self checkMissingPeriodInCode: anEquation ]
129129
ifFalse: [ self checkExtraPeriodInCode: anEquation ]
130130
]
131131

132132
{ #category : 'visiting - inline elements' }
133133
MicLastPeriodInCaptionChecker >> visitFigure: aFigure [
134134

135-
codeShouldEndWithPeriod
135+
isEndingWithPeriod
136136
ifTrue: [ self checkMissingPeriodInFigure: aFigure ]
137137
ifFalse: [ self checkExtraPeriodInFigure: aFigure ]
138138
]
@@ -142,7 +142,7 @@ MicLastPeriodInCaptionChecker >> visitMath: anEquation [
142142
"we should revise the API of elements to be able to identify adorment for Equation, Figure and code block."
143143
"this way we could share the same logic between all the elements."
144144

145-
codeShouldEndWithPeriod
145+
isEndingWithPeriod
146146
ifTrue: [ self checkMissingPeriodInMath: anEquation ]
147147
ifFalse: [ self checkExtraPeriodInMath: anEquation ]
148148
]

src/Microdown-Rules/MicLastPeriodInCaptionCheckerTest.class.st

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,23 @@ MicLastPeriodInCaptionCheckerTest >> setUp [
8080
{ #category : 'tests - missing period' }
8181
MicLastPeriodInCaptionCheckerTest >> testCodeCheckerChecksCorrectlyMissingExtraPeriod [
8282

83-
checker identifyMissingLastPeriod.
83+
checker shouldEndWithPeriod.
8484
checker checkProject: fileSystem / 'codeCaptionEndingWithPeriod.md'.
8585
self assert: checker isOkay
8686
]
8787

8888
{ #category : 'tests - extra period' }
8989
MicLastPeriodInCaptionCheckerTest >> testCodeCheckerChecksCorrectlyNoExtraPeriod [
9090

91-
checker identifyExtraLastPeriod.
91+
checker shouldNotEndWithPeriod.
9292
checker checkProject: fileSystem / 'codeCaptionMissingPeriod.md'.
9393
self assert: checker isOkay
9494
]
9595

9696
{ #category : 'tests - extra period' }
9797
MicLastPeriodInCaptionCheckerTest >> testCodeCheckerIdentifyCorrectlyExtraPeriod [
9898

99-
checker identifyExtraLastPeriod.
99+
checker shouldNotEndWithPeriod.
100100
checker checkProject: fileSystem / 'codeCaptionEndingWithPeriod.md'.
101101
self deny: checker isOkay.
102102

@@ -109,7 +109,7 @@ MicLastPeriodInCaptionCheckerTest >> testCodeCheckerIdentifyCorrectlyExtraPeriod
109109
{ #category : 'tests - missing period' }
110110
MicLastPeriodInCaptionCheckerTest >> testCodeCheckerIdentifyCorrectlyMissingExtraPeriod [
111111

112-
checker identifyMissingLastPeriod.
112+
checker shouldEndWithPeriod.
113113
checker checkProject: fileSystem / 'codeCaptionMissingPeriod.md'.
114114
self deny: checker isOkay.
115115

@@ -122,41 +122,41 @@ MicLastPeriodInCaptionCheckerTest >> testCodeCheckerIdentifyCorrectlyMissingExtr
122122
{ #category : 'tests' }
123123
MicLastPeriodInCaptionCheckerTest >> testConfigureFromFalse [
124124
checker configureFrom: 'false'.
125-
self assert: checker codeShouldEndWithPeriod equals: false.
125+
self assert: checker isEndingWithPeriod equals: false.
126126
]
127127

128128
{ #category : 'tests' }
129129
MicLastPeriodInCaptionCheckerTest >> testConfigureFromNil [
130130
checker configureFrom: nil.
131-
self assert: checker codeShouldEndWithPeriod equals: true.
131+
self deny: checker isEndingWithPeriod.
132132
]
133133

134134
{ #category : 'tests' }
135135
MicLastPeriodInCaptionCheckerTest >> testConfigureFromTrue [
136136
checker configureFrom: 'true'.
137-
self assert: checker codeShouldEndWithPeriod equals: true.
137+
self assert: checker isEndingWithPeriod equals: true.
138138
]
139139

140140
{ #category : 'tests - missing period' }
141141
MicLastPeriodInCaptionCheckerTest >> testFigureCheckerChecksCorrectlyMissingExtraPeriod [
142142

143-
checker identifyMissingLastPeriod.
143+
checker shouldEndWithPeriod.
144144
checker checkProject: fileSystem / 'figureCaptionEndingWithPeriod.md'.
145145
self assert: checker isOkay
146146
]
147147

148148
{ #category : 'tests - extra period' }
149149
MicLastPeriodInCaptionCheckerTest >> testFigureCheckerChecksCorrectlyNoExtraPeriod [
150150

151-
checker identifyExtraLastPeriod.
151+
checker shouldNotEndWithPeriod.
152152
checker checkProject: fileSystem / 'figureCaptionMissingPeriod.md'.
153153
self assert: checker isOkay
154154
]
155155

156156
{ #category : 'tests - extra period' }
157157
MicLastPeriodInCaptionCheckerTest >> testFigureCheckerIdentifyCorrectlyExtraPeriod [
158158

159-
checker identifyExtraLastPeriod.
159+
checker shouldNotEndWithPeriod.
160160
checker checkProject: fileSystem / 'figureCaptionEndingWithPeriod.md'.
161161
self deny: checker isOkay.
162162

@@ -169,7 +169,7 @@ MicLastPeriodInCaptionCheckerTest >> testFigureCheckerIdentifyCorrectlyExtraPeri
169169
{ #category : 'tests - missing period' }
170170
MicLastPeriodInCaptionCheckerTest >> testFigureCheckerIdentifyCorrectlyMissingExtraPeriod [
171171

172-
checker identifyMissingLastPeriod.
172+
checker shouldEndWithPeriod.
173173
checker checkProject: fileSystem / 'figureCaptionMissingPeriod.md'.
174174
self deny: checker isOkay.
175175

@@ -182,23 +182,23 @@ MicLastPeriodInCaptionCheckerTest >> testFigureCheckerIdentifyCorrectlyMissingEx
182182
{ #category : 'tests - missing period' }
183183
MicLastPeriodInCaptionCheckerTest >> testMathCheckerChecksCorrectlyMissingExtraPeriod [
184184

185-
checker identifyMissingLastPeriod.
185+
checker shouldEndWithPeriod.
186186
checker checkProject: fileSystem / 'equationCaptionEndingWithPeriod.md'.
187187
self assert: checker isOkay
188188
]
189189

190190
{ #category : 'tests - extra period' }
191191
MicLastPeriodInCaptionCheckerTest >> testMathCheckerChecksCorrectlyNoExtraPeriod [
192192

193-
checker identifyExtraLastPeriod.
193+
checker shouldNotEndWithPeriod.
194194
checker checkProject: fileSystem / 'equationCaptionMissingPeriod.md'.
195195
self assert: checker isOkay
196196
]
197197

198198
{ #category : 'tests - extra period' }
199199
MicLastPeriodInCaptionCheckerTest >> testMathCheckerIdentifyCorrectlyExtraPeriod [
200200

201-
checker identifyExtraLastPeriod.
201+
checker shouldNotEndWithPeriod.
202202
checker checkProject: fileSystem / 'equationCaptionEndingWithPeriod.md'.
203203
self deny: checker isOkay.
204204

@@ -211,7 +211,7 @@ MicLastPeriodInCaptionCheckerTest >> testMathCheckerIdentifyCorrectlyExtraPeriod
211211
{ #category : 'tests - missing period' }
212212
MicLastPeriodInCaptionCheckerTest >> testMathCheckerIdentifyCorrectlyMissingExtraPeriod [
213213

214-
checker identifyMissingLastPeriod.
214+
checker shouldEndWithPeriod.
215215
checker checkProject: fileSystem / 'equationCaptionMissingPeriod.md'.
216216
self deny: checker isOkay.
217217

src/Microdown-Rules/MicLastPeriodInCodeChecker.class.st

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ MicLastPeriodInCodeChecker >> checkExtraPeriodIn: aMicCodeBlock [
4747
results add: (MicPeriodInCodeResult new
4848
micElement: aMicCodeBlock;
4949
inFile: aMicCodeBlock fromFile;
50-
codeShouldEndWithPeriod: codeShouldEndWithPeriod) ]
50+
codeShouldEndWithPeriod: isEndingWithPeriod) ]
5151
]
5252

5353
{ #category : 'visiting' }
@@ -57,13 +57,13 @@ MicLastPeriodInCodeChecker >> checkMissingPeriodIn: aMicCodeBlock [
5757
results add: (MicPeriodInCodeResult new
5858
micElement: aMicCodeBlock;
5959
inFile: aMicCodeBlock fromFile;
60-
codeShouldEndWithPeriod: codeShouldEndWithPeriod) ]
60+
codeShouldEndWithPeriod: isEndingWithPeriod) ]
6161
]
6262

6363
{ #category : 'visiting' }
6464
MicLastPeriodInCodeChecker >> visitCode: aCodeBlockElement [
6565

66-
codeShouldEndWithPeriod
66+
isEndingWithPeriod
6767
ifTrue: [ self checkMissingPeriodIn: aCodeBlockElement ]
6868
ifFalse: [ self checkExtraPeriodIn: aCodeBlockElement ]
6969
]

0 commit comments

Comments
 (0)