Add absolute path tests for Windows (#230)

This commit is contained in:
Bor Kae Hwang 2020-02-06 09:54:31 -07:00 committed by GitHub
parent 1c5ed0706a
commit 2d4c9528e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -78,12 +78,18 @@ def _is_absolute_test(ctx):
asserts.false(env, paths.is_absolute("foo/")) asserts.false(env, paths.is_absolute("foo/"))
asserts.false(env, paths.is_absolute("foo/bar")) asserts.false(env, paths.is_absolute("foo/bar"))
# Try some absolute paths. # Try some Linux absolute paths.
asserts.true(env, paths.is_absolute("/")) asserts.true(env, paths.is_absolute("/"))
asserts.true(env, paths.is_absolute("/foo")) asserts.true(env, paths.is_absolute("/foo"))
asserts.true(env, paths.is_absolute("/foo/")) asserts.true(env, paths.is_absolute("/foo/"))
asserts.true(env, paths.is_absolute("/foo/bar")) asserts.true(env, paths.is_absolute("/foo/bar"))
# Try some Windows absolute paths.
asserts.true(env, paths.is_absolute("D:\\"))
asserts.true(env, paths.is_absolute("C:\\"))
asserts.true(env, paths.is_absolute("C:\\foo"))
asserts.true(env, paths.is_absolute("C:\\foo\\bar"))
return unittest.end(env) return unittest.end(env)
is_absolute_test = unittest.make(_is_absolute_test) is_absolute_test = unittest.make(_is_absolute_test)