ci: fix the failing os.real_path tests on windows
parent
51596da314
commit
0c922f5570
|
@ -290,7 +290,16 @@ fn test_realpath_of_empty_string_works() {
|
||||||
|
|
||||||
fn test_realpath_non_existing() {
|
fn test_realpath_non_existing() {
|
||||||
non_existing_path := 'sdyfuisd_non_existing_file'
|
non_existing_path := 'sdyfuisd_non_existing_file'
|
||||||
assert os.real_path(non_existing_path) == non_existing_path
|
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() {
|
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)
|
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() {
|
fn test_realpath_does_not_absolutize_non_existing_relative_paths() {
|
||||||
relative_path := os.join_path('one', 'nonexisting_folder', '..', 'something')
|
relative_path := os.join_path('one', 'nonexisting_folder', '..', 'something')
|
||||||
assert os.real_path(relative_path).contains('..')
|
$if !windows {
|
||||||
assert os.real_path(relative_path) == relative_path
|
assert os.real_path(relative_path).contains('..')
|
||||||
|
assert os.real_path(relative_path) == relative_path
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_tmpdir() {
|
fn test_tmpdir() {
|
||||||
|
|
Loading…
Reference in New Issue