From 5a49ac2a6fbd25e9baf228c1fe5ac5bd9e089b78 Mon Sep 17 00:00:00 2001 From: Pawel Sadlo Date: Thu, 5 Sep 2024 15:32:53 +0200 Subject: [PATCH] adding more tests --- os/test/src/PathTests.scala | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/os/test/src/PathTests.scala b/os/test/src/PathTests.scala index 9383b663..5ad1c3f6 100644 --- a/os/test/src/PathTests.scala +++ b/os/test/src/PathTests.scala @@ -34,7 +34,6 @@ object PathTests extends TestSuite { testSegmentsFromString("""ahs/""", "ahs" :: "" :: Nil) testSegmentsFromString("""ahs//""", "ahs" :: "" :: "" :: Nil) - testSegmentsFromString("""ahs/aa/""", "ahs" :: "aa" :: "" :: Nil) testSegmentsFromString("""ahs/aa/""", "ahs" :: "aa" :: "" :: Nil) testSegmentsFromString("""ahs/aa//""", "ahs" :: "aa" :: "" :: "" :: Nil) @@ -47,8 +46,27 @@ object PathTests extends TestSuite { assert(rel / "src" / "Main/.scala" == rel / "src" / "Main" / ".scala") assert(root / "core/src/test" == root / "core" / "src" / "test") assert(root / "core/src/test" == root / "core" / "src/test") + assert(root / "core/ " == root / "core" / " ") + assert(root / " / " == root / " " / " ") } test("Compile errors") { + + compileError("""root / "/" """).check("", nonValidPathSegment("")) + compileError("""root / "/ " """).check("", nonValidPathSegment("")) + compileError("""root / " /" """).check("", nonValidPathSegment("")) + compileError("""root / "//" """).check("", nonValidPathSegment("")) + + compileError("""root / "foo/" """).check("", nonValidPathSegment("")) + compileError("""root / "foo//" """).check("", nonValidPathSegment("")) + + compileError("""root / "foo/bar/" """).check("", nonValidPathSegment("")) + compileError("""root / "foo/bar//" """).check("", nonValidPathSegment("")) + + compileError("""root / "/foo" """).check("", nonValidPathSegment("")) + compileError("""root / "//foo" """).check("", nonValidPathSegment("")) + + compileError("""root / "//foo/" """).check("", nonValidPathSegment("")) + compileError(""" rel / "src" / "" """).check("", nonValidPathSegment("")) compileError(""" rel / "src" / "." """).check("", nonValidPathSegment(".")) compileError(""" rel / "src" / ".." """).check("", nonValidPathSegment(".."))