Skip to content

Commit

Permalink
adding more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelsadlo committed Sep 5, 2024
1 parent 297ef89 commit 5a49ac2
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion os/test/src/PathTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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(".."))
Expand Down

0 comments on commit 5a49ac2

Please sign in to comment.