Skip to content

Commit 5a8d1c0

Browse files
jp-darkmojaveazure
andauthored
Properly normalize paths in tests
Co-authored-by: Paul Hoffman <mojaveazure@users.noreply.github.com>
1 parent 1847134 commit 5a8d1c0

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

inst/tinytest/test_profile.R

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,26 @@ expect_equal(tiledb_profile_name(profile3), "default")
1818
expect_equal(tiledb_profile_name(profile4), "profile4")
1919

2020
# Skipping checks for default directory since it is platform dependent.
21-
dir1_extra_slash <- file.path(base_dir, "tiledb_profile/")
22-
expect_true(tiledb_profile_dir(profile3) == dir1 || tiledb_profile_dir(profile3) == dir1_extra_slash)
23-
expect_true(tiledb_profile_dir(profile4) == dir1 || tiledb_profile_dir(profile4) == dir1_extra_slash)
21+
# Normalize paths on Windows to UNIX-style
22+
profile3_dir <- normalizePath(
23+
path = tiledb_profile_dir(profile3),
24+
winslash = "/",
25+
mustWork = FALSE
26+
)
27+
expect_identical(
28+
# trim trailing slashes
29+
current = sub(pattern = "/+$", replacement = "", x = profile3_dir),
30+
target = dir1
31+
)
32+
profile4_dir <- normalizePath(
33+
path = tiledb_profile_dir(profile4),
34+
winslash = "/",
35+
mustWork = FALSE
36+
)
37+
expect_identical(
38+
current = sub(pattern = "/+$", replacement = "", x = profile4_dir),
39+
target = dir1
40+
)
2441

2542

2643
# 2. Test setting/getting profile parameters.

0 commit comments

Comments
 (0)