ci: fix the failing os.real_path tests on windows

pull/10453/head
Delyan Angelov 2021-06-15 13:34:28 +03:00
parent 51596da314
commit 0c922f5570
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 15 additions and 4 deletions

View File

@ -290,7 +290,16 @@ fn test_realpath_of_empty_string_works() {
fn test_realpath_non_existing() {
non_existing_path := 'sdyfuisd_non_existing_file'
rpath := os.real_path(non_existing_path)
$if windows {
// on windows, the workdir is prepended, so the result is absolute:
assert rpath.len > non_existing_path.len
}
$if !windows {
// on unix, the workdir is NOT prepended for now, so the result remains the same.
// TODO: the windows behaviour seems saner, think about normalising the unix case to do the same.
assert os.real_path(non_existing_path) == non_existing_path
}
}
fn test_realpath_existing() {
@ -322,11 +331,13 @@ fn test_realpath_absolutizes_existing_relative_paths() {
assert os.is_abs_path(real_path_of_examples_folder)
}
// TODO: think much more about whether this is desirable
// TODO: think much more about whether this is desirable:
fn test_realpath_does_not_absolutize_non_existing_relative_paths() {
relative_path := os.join_path('one', 'nonexisting_folder', '..', 'something')
$if !windows {
assert os.real_path(relative_path).contains('..')
assert os.real_path(relative_path) == relative_path
}
}
fn test_tmpdir() {