1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os: fix is_abs_path function for Windows systems (#14397)

This commit is contained in:
Ben
2022-05-16 08:59:37 +02:00
committed by GitHub
parent 7fe3ef9a6e
commit cbb24d34c9
4 changed files with 115 additions and 20 deletions

29
vlib/os/filepath_test.v Normal file
View File

@ -0,0 +1,29 @@
module os
fn test_is_abs_path() {
$if windows {
assert is_abs_path('/')
assert is_abs_path('\\')
assert !is_abs_path('\\\\')
assert is_abs_path(r'C:\path\to\files\file.v')
assert is_abs_path(r'\\Host\share')
assert is_abs_path(r'//Host\share\files\file.v')
assert is_abs_path(r'\\.\BootPartition\Windows')
assert !is_abs_path(r'\\.\')
assert !is_abs_path(r'\\?\\')
assert !is_abs_path(r'C:path\to\dir')
assert !is_abs_path(r'dir')
assert !is_abs_path(r'.\')
assert !is_abs_path(r'.')
assert !is_abs_path(r'\\Host')
assert !is_abs_path(r'\\Host\')
return
}
assert is_abs_path('/')
assert is_abs_path('/path/to/files/file.v')
assert !is_abs_path('\\')
assert !is_abs_path('path/to/files/file.v')
assert !is_abs_path('dir')
assert !is_abs_path('./')
assert !is_abs_path('.')
}