avoid git's line ending translation for this test...

This commit is contained in:
Irmen de Jong 2024-02-03 14:57:25 +01:00
parent 680f5d21ee
commit 78b4288005
2 changed files with 6 additions and 13 deletions

View File

@ -7,10 +7,7 @@ import io.kotest.matchers.shouldNotBe
import io.kotest.matchers.string.shouldContain
import prog8.code.core.SourceCode
import prog8.code.core.SourceCode.Companion.LIBRARYFILEPREFIX
import prog8tests.helpers.assumeNotExists
import prog8tests.helpers.assumeReadableFile
import prog8tests.helpers.fixturesDir
import prog8tests.helpers.resourcesDir
import prog8tests.helpers.*
import kotlin.io.path.Path
@ -71,11 +68,13 @@ class TestSourceCode: AnnotationSpec() {
@Test
fun testFromPathWithExistingPathDOSLineEndings() {
val filename = "dos_line_endings.p8"
val path = assumeReadableFile(fixturesDir, filename)
val text = "main {\r\nline2\r\nline3\r\n}\r"
val filePath = outputDir.resolve("on_the_fly_test_" + text.hashCode().toUInt().toString(16) + ".p8")
filePath.toFile().writeText(text)
val path = assumeReadableFile(fixturesDir, filePath)
val src = SourceCode.File(path)
src.text shouldNotBe path.toFile().readText() // should be normalized!
src.text.split('\r', '\n').size shouldBe 7
src.text.split('\r', '\n').size shouldBe 5
}
@Test

View File

@ -1,6 +0,0 @@
main {
sub start() {
}
}
; CR LF line endings