os: add test for os.file_name (#8757)

pull/8767/head
zakuro 2021-02-15 15:37:35 +09:00 committed by GitHub
parent b07f373433
commit 4e2418e9cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -415,6 +415,19 @@ fn test_base() {
assert os.base('filename') == 'filename'
}
fn test_file_name() {
$if windows {
assert os.file_name('v\\vlib\\os\\os.v') == 'os.v'
assert os.file_name('v\\vlib\\os\\') == ''
assert os.file_name('v\\vlib\\os') == 'os'
} $else {
assert os.file_name('v/vlib/os/os.v') == 'os.v'
assert os.file_name('v/vlib/os/') == ''
assert os.file_name('v/vlib/os') == 'os'
}
assert os.file_name('filename') == 'filename'
}
fn test_uname() {
u := os.uname()
assert u.sysname.len > 0