mirror of
https://github.com/irmen/prog8.git
synced 2025-01-10 20:30:23 +00:00
Merge branch 'refs/heads/fixwindowseolstests'
This commit is contained in:
commit
ae0d52274c
@ -54,6 +54,11 @@ class TestSourceCode: AnnotationSpec() {
|
|||||||
shouldThrow<FileSystemException> { SourceCode.File(fixturesDir) }
|
shouldThrow<FileSystemException> { SourceCode.File(fixturesDir) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun normalizeLineEndings(text: String): String {
|
||||||
|
return text.replace("\\R".toRegex(), "\n")
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testFromPathWithExistingPath() {
|
fun testFromPathWithExistingPath() {
|
||||||
val filename = "ast_simple_main.p8"
|
val filename = "ast_simple_main.p8"
|
||||||
@ -61,7 +66,7 @@ class TestSourceCode: AnnotationSpec() {
|
|||||||
val src = SourceCode.File(path)
|
val src = SourceCode.File(path)
|
||||||
val expectedOrigin = SourceCode.relative(path).toString()
|
val expectedOrigin = SourceCode.relative(path).toString()
|
||||||
src.origin shouldBe expectedOrigin
|
src.origin shouldBe expectedOrigin
|
||||||
src.text shouldBe path.toFile().readText()
|
src.text shouldBe normalizeLineEndings(path.toFile().readText())
|
||||||
src.isFromResources shouldBe false
|
src.isFromResources shouldBe false
|
||||||
src.isFromFilesystem shouldBe true
|
src.isFromFilesystem shouldBe true
|
||||||
}
|
}
|
||||||
@ -85,7 +90,7 @@ class TestSourceCode: AnnotationSpec() {
|
|||||||
val src = SourceCode.File(path)
|
val src = SourceCode.File(path)
|
||||||
val expectedOrigin = SourceCode.relative(path).toString()
|
val expectedOrigin = SourceCode.relative(path).toString()
|
||||||
src.origin shouldBe expectedOrigin
|
src.origin shouldBe expectedOrigin
|
||||||
src.text shouldBe srcFile.readText()
|
src.text shouldBe normalizeLineEndings(srcFile.readText())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -95,7 +100,7 @@ class TestSourceCode: AnnotationSpec() {
|
|||||||
val src = SourceCode.Resource(pathString)
|
val src = SourceCode.Resource(pathString)
|
||||||
|
|
||||||
src.origin shouldBe "$LIBRARYFILEPREFIX/$pathString"
|
src.origin shouldBe "$LIBRARYFILEPREFIX/$pathString"
|
||||||
src.text shouldBe srcFile.readText()
|
src.text shouldBe normalizeLineEndings(srcFile.readText())
|
||||||
src.isFromResources shouldBe true
|
src.isFromResources shouldBe true
|
||||||
src.isFromFilesystem shouldBe false
|
src.isFromFilesystem shouldBe false
|
||||||
}
|
}
|
||||||
@ -107,7 +112,7 @@ class TestSourceCode: AnnotationSpec() {
|
|||||||
val src = SourceCode.Resource(pathString)
|
val src = SourceCode.Resource(pathString)
|
||||||
|
|
||||||
src.origin shouldBe "$LIBRARYFILEPREFIX$pathString"
|
src.origin shouldBe "$LIBRARYFILEPREFIX$pathString"
|
||||||
src.text shouldBe srcFile.readText()
|
src.text shouldBe normalizeLineEndings(srcFile.readText())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -117,7 +122,7 @@ class TestSourceCode: AnnotationSpec() {
|
|||||||
val src = SourceCode.Resource(pathString)
|
val src = SourceCode.Resource(pathString)
|
||||||
|
|
||||||
src.origin shouldBe "$LIBRARYFILEPREFIX/$pathString"
|
src.origin shouldBe "$LIBRARYFILEPREFIX/$pathString"
|
||||||
src.text shouldBe srcFile.readText()
|
src.text shouldBe normalizeLineEndings(srcFile.readText())
|
||||||
src.isFromResources shouldBe true
|
src.isFromResources shouldBe true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +133,7 @@ class TestSourceCode: AnnotationSpec() {
|
|||||||
val src = SourceCode.Resource(pathString)
|
val src = SourceCode.Resource(pathString)
|
||||||
|
|
||||||
src.origin shouldBe "$LIBRARYFILEPREFIX$pathString"
|
src.origin shouldBe "$LIBRARYFILEPREFIX$pathString"
|
||||||
src.text shouldBe srcFile.readText()
|
src.text shouldBe normalizeLineEndings(srcFile.readText())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -138,7 +143,7 @@ class TestSourceCode: AnnotationSpec() {
|
|||||||
val src = SourceCode.Resource(pathString)
|
val src = SourceCode.Resource(pathString)
|
||||||
|
|
||||||
src.origin shouldBe "$LIBRARYFILEPREFIX/prog8lib/math.p8"
|
src.origin shouldBe "$LIBRARYFILEPREFIX/prog8lib/math.p8"
|
||||||
src.text shouldBe srcFile.readText()
|
src.text shouldBe normalizeLineEndings(srcFile.readText())
|
||||||
src.isFromResources shouldBe true
|
src.isFromResources shouldBe true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user