Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/Microdown-BookTester-Tests/MicReferenceCheckerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ MicReferenceCheckerTest >> testDefFig1AndRefToAncS0UnknowAnchor [
self deny: visitor isOkay.
badRefs := visitor results select: [ :each | each isKindOf: MicAnchorResult ].
self assert: badRefs first anchorLabel equals: 'ancS0'.
self assert: badRefs first sourceFileReference fullName equals: '/defFig1AndRefToAncS0.md'
self assert: badRefs first inFile fullName equals: '/defFig1AndRefToAncS0.md'
]

{ #category : 'tests - single file ok references' }
Expand All @@ -406,7 +406,7 @@ MicReferenceCheckerTest >> testDefFig1AndRefToAncUnkS0 [
self assert: visitor results size equals: 3.
self assert: visitor results second anchorLabel equals: 'ancUnkS0'.
self
assert: visitor results second sourceFileReference fullName
assert: visitor results second inFile fullName
equals: '/defFig1AndRefToAncUnkS0.md'
]

Expand Down Expand Up @@ -444,7 +444,7 @@ MicReferenceCheckerTest >> testDefS1ButRefersToS0UnknownAnchor [
self deny: visitor isOkay.
self assert: visitor results size equals: 3.
self assert: visitor results second anchorLabel equals: 'ancS0'.
self assert: visitor results second sourceFileReference fullName equals: '/fileDefAncS1UndAncS0.md'
self assert: visitor results second inFile fullName equals: '/fileDefAncS1UndAncS0.md'

]

Expand Down Expand Up @@ -549,7 +549,7 @@ MicReferenceCheckerTest >> testDuplicatedAnchorInDifferentFilesOfTheSameDir [
dict := visitor results groupedBy: [ :each | each class ].
duplicated := (dict at: MicDuplicatedAnchorResult) first.
self
assert: visitor results first sourceFileReference fullName
assert: visitor results first inFile fullName
equals: '/myDirectory/file2.md'.
self assert: duplicated anchorLabel equals: 'ancS1'
]
Expand All @@ -570,7 +570,7 @@ MicReferenceCheckerTest >> testDuplicatedAnchors [

dup1 := (dict at: MicDuplicatedAnchorResult) first.
self
assert: dup1 sourceFileReference fullName
assert: dup1 inFile fullName
equals: '/myDirectory/defAncS0TripleAncS1RefAncS1AncS0.md'.
self assert: dup1 anchorLabel equals: 'ancS1'
]
Expand Down Expand Up @@ -626,7 +626,7 @@ MicReferenceCheckerTest >> testDuplicatedFigures [

dup1 := (dict at: MicDuplicatedAnchorResult) first.
self
assert: dup1 sourceFileReference fullName
assert: dup1 inFile fullName
equals: '/myDirectory/defAncS0DoubleFig1Fig2RefAncS1.md'.
self assert: dup1 anchorLabel equals: 'fig1'
]
Expand All @@ -640,7 +640,7 @@ MicReferenceCheckerTest >> testDuplicatedMaths [
checker checkList: { defAnCS0DoubleEq2DoubleEq1RefEq1 }.
self deny: checker isOkay.
self
assert: checker results first sourceFileReference fullName
assert: checker results first inFile fullName
equals: defAnCS0DoubleEq2DoubleEq1RefEq1 fullName.
self
assert: (checker results collect: [ :each | each anchorLabel ])
Expand All @@ -649,11 +649,11 @@ MicReferenceCheckerTest >> testDuplicatedMaths [
dict := checker results groupedBy: [ :each | each class ].

dup1 := (dict at: MicDuplicatedAnchorResult) first.
self assert: dup1 sourceFileReference fullName equals: '/myDirectory/defAnCS0DoubleEq2DoubleEq1RefEq1.md'.
self assert: dup1 inFile fullName equals: '/myDirectory/defAnCS0DoubleEq2DoubleEq1RefEq1.md'.
self assert: dup1 anchorLabel equals: 'Eq2'.

dup2 := (dict at: MicDuplicatedAnchorResult) third.
self assert: dup2 sourceFileReference fullName equals: '/myDirectory/defAnCS0DoubleEq2DoubleEq1RefEq1.md'.
self assert: dup2 inFile fullName equals: '/myDirectory/defAnCS0DoubleEq2DoubleEq1RefEq1.md'.
self assert: dup2 anchorLabel equals: 'Eq1'.
]

Expand All @@ -672,7 +672,7 @@ MicReferenceCheckerTest >> testFigureFilePathToUnkFile [
self assert: refToUnexistingFiles first figureFileString equals: 'figures/f.png'.

self
assert: refToUnexistingFiles first sourceFileReference fullName
assert: refToUnexistingFiles first inFile fullName
equals: '/myDirectory/defAndRefFig1.md'
]

Expand Down Expand Up @@ -701,11 +701,11 @@ MicReferenceCheckerTest >> testFullProjectWithReferencesToUnknowAnchor [
dict := checker results groupedBy: [ :each | each class ].

unk := (dict at: MicReferenceToUnexistingAnchorResult) first.
self assert: unk sourceFileReference fullName equals: '/myDirectory/sections/section2.md'.
self assert: unk inFile fullName equals: '/myDirectory/sections/section2.md'.
self assert: unk anchorLabel equals: 'ancUnkS2'.

undefined := (dict at: MicUndefinedInputFileResult) first.
self assert: undefined sourceFileReference fullName equals: '/myDirectory/sections/section2.md'.
self assert: undefined inFile fullName equals: '/myDirectory/sections/section2.md'.


]
Expand Down Expand Up @@ -802,7 +802,7 @@ MicReferenceCheckerTest >> testRefersToUnkAncS1 [
self deny: visitor isOkay.
self assert: visitor results size equals: 1.
self assert: visitor results first anchorLabel equals: 'ancS1'.
self assert: visitor results first sourceFileReference fullName equals: '/fileRefAncS1.md'.
self assert: visitor results first inFile fullName equals: '/fileRefAncS1.md'.
]

{ #category : 'tests - duplicated' }
Expand Down Expand Up @@ -921,7 +921,7 @@ MicReferenceCheckerTest >> testUnreferencedFigure [
self assert: badRefs size equals: 1.
self assert: unref figurePath equals: 'figures/f.png'.
self assert: unref anchorLabel equals: 'Fig1'.
self assert: unref sourceFileReference fullName equals: '/defFig1.md'
self assert: unref inFile fullName equals: '/defFig1.md'
]

{ #category : 'tests - single file' }
Expand Down
14 changes: 7 additions & 7 deletions src/Microdown-BookTester-Tests/MicResultTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ MicResultTest >> testExplanationDuplicatedAnchor [
| res |
res := MicDuplicatedAnchorResult new.
res anchorLabel: 'ancS0'.
res sourceFileReference: '/myDir/chapter1.md' asFileReference.
res inFile: '/myDir/chapter1.md' asFileReference.

self
assert: res explanation
Expand All @@ -27,7 +27,7 @@ MicResultTest >> testExplanationUndefinedAnchor [
res anchorLabel: 'ancS0'.
"pay attention since in this package fromFile is pass a fullName and not a file we will have to change
this later"
res sourceFileReference: '/myDir/chapter1.md' asFileReference.
res inFile: '/myDir/chapter1.md' asFileReference.

self
assert: res explanation
Expand Down Expand Up @@ -78,7 +78,7 @@ MicResultTest >> testSTONFormatExplanationDuplicatedAnchor [
res anchorLabel: 'ancS0'.
"pay attention since in this package fromFile is pass a fullName and not a file we will have to change
this later"
res sourceFileReference: '/myDir/chapter1.md' asFileReference.
res inFile: '/myDir/chapter1.md' asFileReference.

association := res stonFormatExplanation.

Expand All @@ -97,7 +97,7 @@ MicResultTest >> testSTONFormatExplanationUndefinedAnchor [
res anchorLabel: 'ancS0'.
"pay attention since in this package fromFile is pass a fullName and not a file we will have to change
this later"
res sourceFileReference: '/myDir/chapter1.md' asFileReference .
res inFile: '/myDir/chapter1.md' asFileReference .

association := res stonFormatExplanation.

Expand All @@ -114,7 +114,7 @@ MicResultTest >> testUndefinedFigureFile [
| res |
res := MicUndefinedFigureFileResult new.
res figureFileString: 'myDir/foo.png'.
res sourceFileReference: '/myDir/chapter2.md' asFileReference.
res inFile: '/myDir/chapter2.md' asFileReference.

self
assert: res explanation
Expand All @@ -128,8 +128,8 @@ MicResultTest >> testUndefinedInputFile [
| res |
res := MicUndefinedInputFileResult new.
res inputFileBlock: (MicInputfileBlock new path: 'myDir/foo.md').
res sourceFileReference: '/myDir/chapter2.md' asFileReference.
res sourceFileReference: '/myDir/chapter2.md' asFileReference.
res inFile: '/myDir/chapter2.md' asFileReference.
res inFile: '/myDir/chapter2.md' asFileReference.

self
assert: res explanation
Expand Down
44 changes: 0 additions & 44 deletions src/Microdown-BookTester/MicAbstractResult.class.st

This file was deleted.

4 changes: 2 additions & 2 deletions src/Microdown-BookTester/MicAnchorResult.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ MicAnchorResult >> anchorLabel: anObject [
{ #category : 'accessing' }
MicAnchorResult >> explanation [

^ 'Anchor ', anchorLabel, ' is ', self isWhat, ' in file: ', source fullName
^ 'Anchor ', anchorLabel, ' is ', self isWhat, ' in file: ', fileReference fullName

]

Expand All @@ -46,6 +46,6 @@ MicAnchorResult >> isWhat [
{ #category : 'accessing' }
MicAnchorResult >> stonFormatExplanation [

^ Association new key: anchorLabel value: source
^ Association new key: anchorLabel value: fileReference

]
6 changes: 3 additions & 3 deletions src/Microdown-BookTester/MicBookTestResult.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ MicBookTestResult >> explanation [
self text ,
String cr ,
'from the source file: ' ,
self sourceFileReference fullName
self inFile fullName


]
Expand Down Expand Up @@ -117,7 +117,7 @@ MicBookTestResult >> initialize [
isExpectedFailure := false.
message := 'Test failed without raising an exception'.
text := 'here we should get an expression'.
source := '' asFileReference.
fileReference := '' asFileReference.
]

{ #category : 'accessing' }
Expand Down Expand Up @@ -160,7 +160,7 @@ MicBookTestResult >> stonFormatExplanation [
self text , '",',
String cr ,
'"sourceFile" : "' ,
self sourceFileReference fullname , '"',
self inFile fullname , '"',
String cr , '}'


Expand Down
2 changes: 1 addition & 1 deletion src/Microdown-BookTester/MicCheckerHTMLReporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ MicCheckerHTMLReporter >> buildResultsOn: aStream [
nextPutAll: '<div class="section err-section"><div class="section-header" onclick="toggle(this)"><span class="section-badge badge-error">' , count printString , ' error' , (count = 1 ifTrue: [''] ifFalse: ['s']) , '</span><span class="section-title">' , (self htmlEscape: header) , '</span><span class="chevron open">&#9660;</span></div><div class="section-body">'.
errorList do: [ :r |
| lineNum srcFile searchText fullPath shortMsg context |
srcFile := r sourceFileReference ifNil: [ fileReference ].
srcFile := r inFile ifNil: [ fileReference ].
searchText := ((r class methodDict includesKey: #what) and: [ r what notNil and: [ r what notEmpty ] ])
ifTrue: [ r what ]
ifFalse: [
Expand Down
4 changes: 2 additions & 2 deletions src/Microdown-BookTester/MicCodeIndentationResult.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Class {
#name : 'MicCodeIndentationResult',
#superclass : 'MicAbstractResult',
#superclass : 'MicResult',
#instVars : [
'detail'
],
Expand All @@ -24,7 +24,7 @@ MicCodeIndentationResult >> detail: anObject [
{ #category : 'accessing' }
MicCodeIndentationResult >> explanation [
^ 'Text: "' , micElement body
, '" in file' , fileReference fullName
, '" in file' , self inFile fullName
, ' contains a mistake: line ['
, detail
, '] should use tabs instead of spaces for indentation.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ MicDesynchronizedCodeResult >> bookContents: aString [
{ #category : 'accessing' }
MicDesynchronizedCodeResult >> explanation [

^ 'The code block body of ', originString , ' is not in sync with the version in Pharo ', pharoVersion, 'in file: ', source fullName
^ 'The code block body of ', originString , ' is not in sync with the version in Pharo ', pharoVersion, 'in file: ', self inFile fullName
]

{ #category : 'accessing' }
Expand Down
4 changes: 2 additions & 2 deletions src/Microdown-BookTester/MicDoublePeriodResult.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Class {
#name : 'MicDoublePeriodResult',
#superclass : 'MicAbstractResult',
#superclass : 'MicResult',
#category : 'Microdown-BookTester-Checker-LastPeriod',
#package : 'Microdown-BookTester',
#tag : 'Checker-LastPeriod'
Expand All @@ -9,5 +9,5 @@ Class {
{ #category : 'accessing' }
MicDoublePeriodResult >> explanation [

^ 'Text: "' , micElement text , '" in file' , fileReference fullName , ' contains two periods.'
^ 'Text: "' , micElement text , '" in file' , self inFile fullName , ' contains two periods.'
]
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Class {

{ #category : 'accessing' }
MicElementAfterColonIsNotCapitalizedResult >> explanation [
^ 'Header: "' , micElement text , '" in file' , fileReference fullName , ' contains a mistake: ', detail , ' as first letter after a colon should be uppercased.'
^ 'Header: "' , micElement text , '" in file' , self inFile fullName , ' contains a mistake: ', detail , ' as first letter after a colon should be uppercased.'
]
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Class {

{ #category : 'accessing' }
MicElementOfHeaderIsNotCapitalizedResult >> explanation [
^ 'Header: "' , micElement text , '" in file' , fileReference fullName , ' contains a mistake: ' , detail , ' should be capitalized.'
^ 'Header: "' , micElement text , '" in file' , self inFile fullName , ' contains a mistake: ' , detail , ' should be capitalized.'
]
4 changes: 2 additions & 2 deletions src/Microdown-BookTester/MicEnglishTypographyResult.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Class {
#name : 'MicEnglishTypographyResult',
#superclass : 'MicAbstractResult',
#superclass : 'MicResult',
#instVars : [
'detail'
],
Expand Down Expand Up @@ -34,7 +34,7 @@ MicEnglishTypographyResult >> explanation [
self flag: #todo.
"this looks like a bug or hidden a bug!"

^ 'Text: "' , text , '" in file' , fileReference fullName , ' contains a mistake: ', detail
^ 'Text: "' , text , '" in file' , self inFile fullName , ' contains a mistake: ', detail
]

{ #category : 'kinds' }
Expand Down
2 changes: 1 addition & 1 deletion src/Microdown-BookTester/MicExampleTesterStrategy.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ MicExampleTesterStrategy >> verify: aCodeBlock [
| result |
result := MicBookTestResult new.
result text: aCodeBlock code.
result sourceFileReference: aCodeBlock fromFile.
result inFile: aCodeBlock fromFile.
results add: result.
self executeAndReportIn: result.
aCodeBlock isExpectedFailure
Expand Down
4 changes: 2 additions & 2 deletions src/Microdown-BookTester/MicFileResult.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ Class {
{ #category : 'accessing' }
MicFileResult >> explanation [

^ 'File input ', self what,' (in file ', source fullName , ') does not exist.'
^ 'File input ', self what,' (in file ', fileReference fullName , ') does not exist.'

]

{ #category : 'accessing' }
MicFileResult >> stonFormatExplanation [

^ '"', self what,'" : "', source , '"'
^ '"', self what,'" : "', fileReference , '"'

]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ Class {
MicFirstElementOfHeaderIsNotCapitalizedResult >> explanation [


^ 'Header: "' , micElement text , '" in file' , fileReference fullName , ' contains a mistake: ', detail, ' as first word of the header should be uppercased.'
^ 'Header: "' , micElement text , '" in file' , self inFile fullName , ' contains a mistake: ', detail, ' as first word of the header should be uppercased.'

]
4 changes: 2 additions & 2 deletions src/Microdown-BookTester/MicFrenchTypographyResult.class.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Class {
#name : 'MicFrenchTypographyResult',
#superclass : 'MicAbstractResult',
#superclass : 'MicResult',
#instVars : [
'detail'
],
Expand All @@ -26,6 +26,6 @@ MicFrenchTypographyResult >> explanation [
| text |
text := micElement bodyString ifNil: [ '' ].
^ 'Text: "' , text
, '" in file' , fileReference fullName
, '" in file' , self inFile fullName
, ' contains a mistake: ' , detail
]
Loading
Loading