From 78b42880050eb5f66de88a6d7ae436e20ada9238 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sat, 3 Feb 2024 14:57:25 +0100 Subject: [PATCH] avoid git's line ending translation for this test... --- compiler/test/ast/TestSourceCode.kt | 13 ++++++------- compiler/test/fixtures/dos_line_endings.p8 | 6 ------ 2 files changed, 6 insertions(+), 13 deletions(-) delete mode 100644 compiler/test/fixtures/dos_line_endings.p8 diff --git a/compiler/test/ast/TestSourceCode.kt b/compiler/test/ast/TestSourceCode.kt index 9997647f3..b07b9c0a4 100644 --- a/compiler/test/ast/TestSourceCode.kt +++ b/compiler/test/ast/TestSourceCode.kt @@ -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 diff --git a/compiler/test/fixtures/dos_line_endings.p8 b/compiler/test/fixtures/dos_line_endings.p8 deleted file mode 100644 index 42c62e319..000000000 --- a/compiler/test/fixtures/dos_line_endings.p8 +++ /dev/null @@ -1,6 +0,0 @@ -main { - sub start() { - } -} - -; CR LF line endings