Skip to content

Commit

Permalink
Rename the test package
Browse files Browse the repository at this point in the history
Rename classes and 
Add the package to the baseline
  • Loading branch information
Ducasse committed Jun 6, 2024
1 parent 6fd599b commit beec7ec
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
4 changes: 4 additions & 0 deletions src/BaselineOfMicrodown/BaselineOfMicrodown.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ BaselineOfMicrodown >> baseline: spec [

package: #'Microdown-ParentChildrenChecker' with: [
spec requires: #( #'Microdown' ) ];
package: #'Microdown-BookTester' with: [
spec requires: #( #'Microdown' ) ];
package: #'Microdown-BookTester-Tests' with: [
spec requires: #( #'Microdown-BookTester' ) ];

package: #'Microdown-Blog' with: [
spec requires: #( #'Microdown' ) ];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fragmentedText: #('Plop' 'plop1' '^ ''1''')
"
Class {
#name : 'MicrodownBookTestResult',
#name : 'MicBookTestResult',
#superclass : 'Object',
#instVars : [
'text',
Expand All @@ -42,25 +42,25 @@ Class {
}

{ #category : 'accessing' }
MicrodownBookTestResult >> explanation [
MicBookTestResult >> explanation [

^ explanation
]

{ #category : 'accessing' }
MicrodownBookTestResult >> explanation: anException [
MicBookTestResult >> explanation: anException [

explanation := anException
]

{ #category : 'accessing' }
MicrodownBookTestResult >> fragmentedText [
MicBookTestResult >> fragmentedText [

^ fragmentedText
]

{ #category : 'accessing' }
MicrodownBookTestResult >> fragmentedText: aText [
MicBookTestResult >> fragmentedText: aText [
"The Array contains:
-Class Name
-Method Name
Expand All @@ -69,47 +69,47 @@ MicrodownBookTestResult >> fragmentedText: aText [
]

{ #category : 'initialization' }
MicrodownBookTestResult >> initialize [
MicBookTestResult >> initialize [

super initialize.
status := true.
explanation := 'Test failed without raising an exception'
]

{ #category : 'testing' }
MicrodownBookTestResult >> isFailed [
MicBookTestResult >> isFailed [

^ status not
]

{ #category : 'testing' }
MicrodownBookTestResult >> isValid [
MicBookTestResult >> isValid [

^ status
]

{ #category : 'accessing' }
MicrodownBookTestResult >> status [
MicBookTestResult >> status [
"true means that the test is valid, false means that the test got a problem or failed"

^ status
]

{ #category : 'accessing' }
MicrodownBookTestResult >> status: aBoolean [
MicBookTestResult >> status: aBoolean [
"true means that the test is valid, false means that the test got a problem or failed"

status := aBoolean
]

{ #category : 'accessing' }
MicrodownBookTestResult >> text [
MicBookTestResult >> text [

^ text
]

{ #category : 'accessing' }
MicrodownBookTestResult >> text: aText [
MicBookTestResult >> text: aText [

text := aText
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
i visit code blocks and make sure that evaluation is correct
"
Class {
#name : 'MicrodownBookTesterVisitor',
#name : 'MicBookTesterVisitor',
#superclass : 'MicrodownVisitor',
#instVars : [
'allTestResults'
Expand All @@ -12,31 +12,31 @@ Class {
}

{ #category : 'testing' }
MicrodownBookTesterVisitor class >> isAbstract [
MicBookTesterVisitor class >> isAbstract [
<ignoreForCoverage "This method is ignored for test coverage because it is overriden in all subclasses and these subclasses don't need to do a super-send.">
^ false
]

{ #category : 'accessing' }
MicrodownBookTesterVisitor >> allTestResults [
MicBookTesterVisitor >> allTestResults [

^ allTestResults
]

{ #category : 'accessing' }
MicrodownBookTesterVisitor >> allTestResults: anObject [
MicBookTesterVisitor >> allTestResults: anObject [

allTestResults := anObject
]

{ #category : 'visiting' }
MicrodownBookTesterVisitor >> checkAssociation: aCodeBlockObject [
MicBookTesterVisitor >> checkAssociation: aCodeBlockObject [
"Asserts the association created in any codeBlock "
^ (self class compiler evaluate: aCodeBlockObject text ) isPaired .
]

{ #category : 'visiting' }
MicrodownBookTesterVisitor >> excuteAndReportExample: aCodeBlockObject [
MicBookTesterVisitor >> excuteAndReportExample: aCodeBlockObject [
"aCodeBlockObject is an instance of The MicrodownTestResult"
| isCorrect |
isCorrect := false .
Expand All @@ -49,46 +49,46 @@ MicrodownBookTesterVisitor >> excuteAndReportExample: aCodeBlockObject [
]

{ #category : 'visiting' }
MicrodownBookTesterVisitor >> failedTests [
MicBookTesterVisitor >> failedTests [
"Returns the failed tests within the test results"
^ allTestResults select: [ :each | each isFailed ]
]

{ #category : 'initialization' }
MicrodownBookTesterVisitor >> initialize [
MicBookTesterVisitor >> initialize [
super initialize.
allTestResults := OrderedCollection new.
]

{ #category : 'visiting' }
MicrodownBookTesterVisitor >> isOk [
MicBookTesterVisitor >> isOk [
| checkingVariable |
checkingVariable := true.
allTestResults do: [ :each | checkingVariable := checkingVariable and: [ each isPaired ] ].
^ checkingVariable
]

{ #category : 'accessing' }
MicrodownBookTesterVisitor >> start: anObject [
MicBookTesterVisitor >> start: anObject [
anObject accept: self .

]

{ #category : 'testing' }
MicrodownBookTesterVisitor >> validTests [
MicBookTesterVisitor >> validTests [
"Returns all passed tests"
^ allTestResults select: [ :each | each isValid ]
]

{ #category : 'visiting' }
MicrodownBookTesterVisitor >> visitCode: aCodeBlock [
MicBookTesterVisitor >> visitCode: aCodeBlock [
"Creates an instance of PRBookTestResult with parameters depending of the type of the codeblock.
Here it is for an example and therefore uses the specialized exmple methods
textForTestcase
executeAndReportExample:
Note that there is no fragmentedText here, no need for it b/ecause the codeblock text contains the whole text and is the equivalent of Playground execution"
| result |
result := MicrodownBookTestResult new.
result := MicBookTestResult new.
result text: aCodeBlock code.
allTestResults add: result .
self excuteAndReportExample: result.
Expand Down

0 comments on commit beec7ec

Please sign in to comment.