Skip to content

Commit

Permalink
spesific tests fron the new checkDirectory
Browse files Browse the repository at this point in the history
  • Loading branch information
melkiyasser committed Sep 5, 2024
1 parent 3036465 commit ddaee9a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 11 deletions.
23 changes: 23 additions & 0 deletions src/Microdown-BookTester-Tests/MicFileTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,17 @@ just text here
' ]
]

{ #category : 'helpers - only inputfiles' }
MicFileTest >> section1IsLeafButContainsSomeUknownAnchors [

section1 := dir / 'section1.md'.
section1 ensureCreateFile.
section1 writeStreamDo: [ :stream |
stream nextPutAll: '# Section1
here are some unknown anchors to prove that checkDirectory is working See *@anchorSection100@* and *@anchorSection200@*
' ]
]

{ #category : 'helpers - only inputfiles' }
MicFileTest >> section2InputsNestedSection3 [

Expand Down Expand Up @@ -342,6 +353,18 @@ MicFileTest >> section4InputsParentSection3 [
' ]
]

{ #category : 'helpers - only inputfiles' }
MicFileTest >> section4InputsParentSection3withUknownAnchors [

section4 := dir / 'sections/subsections/subsubsections/section4.md'.
section4 ensureCreateFile.
section4 writeStreamDo: [ :stream |
stream nextPutAll: '# section 4
<!inputFile|path=../section3.md!>
here are some unknown anchors to prove that checkDirectory is working See *@anchorSection100@* and *@anchorSection200@*
' ]
]

{ #category : 'helpers - only inputfiles' }
MicFileTest >> section4InputsSection1 [

Expand Down
18 changes: 8 additions & 10 deletions src/Microdown-BookTester-Tests/MicReferenceCheckerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,10 @@ Just a reference See *@ancS1@* ' ].

]

{ #category : 'skipped for now' }
{ #category : 'tests - single file' }
MicReferenceCheckerTest >> testDuplicatedAnchorDir [

| dir file1 file2 visitor |
self skip.
| file1 file2 visitor |
dir := (FileSystem workingDirectory / 'myDirectory') asFileReference.
dir ensureCreateDirectory.

Expand All @@ -465,8 +464,8 @@ MicReferenceCheckerTest >> testDuplicatedAnchorDir [
file2 ensureCreateFile .

visitor := MicReferenceChecker new.

self deny: ( visitor checkDirectory: dir )
visitor checkDirectory: dir .
self deny: ( visitor isOkay )

]

Expand Down Expand Up @@ -770,11 +769,10 @@ MicReferenceCheckerTest >> testReportingSTONFormatUnknownAnchorDir [

]

{ #category : 'skipped for now' }
{ #category : 'tests - single file' }
MicReferenceCheckerTest >> testReportingUnknownAnchorDir [

| dir file1 file2 visitor |
self skip.
| file1 file2 visitor |
dir := (FileSystem workingDirectory / 'myDirectory') asFileReference.
dir ensureCreateDirectory.

Expand All @@ -794,8 +792,8 @@ MicReferenceCheckerTest >> testReportingUnknownAnchorDir [
file2 ensureCreateFile.

visitor := MicReferenceChecker new.

self deny: (visitor checkDirectory: dir).
visitor checkDirectory: dir .
self deny: (visitor isOkay ).

file1 ensureDelete.
file2 ensureDelete.
Expand Down
2 changes: 1 addition & 1 deletion src/Microdown-BookTester/MicReferenceChecker.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ MicReferenceChecker >> checkDirectory: aDir [
aDir allFiles do: [ :file | collector add: (Microdown parseFile: file ) ].

collector
fileSystem: FileSystem memory ;
rootDirectory: FileSystem memory ;
visit: collector workList first .
self handleUndefinedFilesFrom: collector.
listOfFiles := collector visitedDocumentFiles collect: [ :file |
Expand Down

0 comments on commit ddaee9a

Please sign in to comment.