mirror of
https://github.com/nushell/nushell.git
synced 2025-04-23 12:48:22 +02:00
After #14906, the test runner was updated to use attributes, along with the existing `std` modules. However, since that PR was started before `std-rfc` was in main, it didn't include updates to those tests. Once #14906 was merged, the `std-rfc` tests no longer ran in CI. This PR updates the tests accordingly.
40 lines
1.5 KiB
Plaintext
40 lines
1.5 KiB
Plaintext
use std-rfc/path
|
|
use std/assert
|
|
use std/testing *
|
|
|
|
@test
|
|
def path_with_extension [] {
|
|
let new_path = "ab.txt" | path with-extension "rs"
|
|
assert equal $new_path "ab.rs"
|
|
|
|
let new_path = "ab.txt" | path with-extension ".rs"
|
|
assert equal $new_path "ab.rs"
|
|
}
|
|
|
|
@test
|
|
def path_with_extension_for_list [] {
|
|
let new_path = ["ab.txt", "cd.exe"] | path with-extension "rs"
|
|
assert equal $new_path ["ab.rs", "cd.rs"]
|
|
|
|
let new_path = ["ab.txt", "cd.exe"] | path with-extension ".rs"
|
|
assert equal $new_path ["ab.rs", "cd.rs"]
|
|
}
|
|
|
|
@test
|
|
def path_with_stem [] {
|
|
let new_path = $"(char psep)usr(char psep)bin" | path with-stem "share"
|
|
assert equal $new_path $"(char psep)usr(char psep)share"
|
|
|
|
let new_path = [$"(char psep)home(char psep)alice(char psep)", $"(char psep)home(char psep)bob(char psep)secret.txt"] | path with-stem "nushell"
|
|
assert equal $new_path [$"(char psep)home(char psep)nushell", $"(char psep)home(char psep)bob(char psep)nushell.txt"]
|
|
}
|
|
|
|
@test
|
|
def path_with_parent [] {
|
|
let new_path = $"(char psep)etc(char psep)foobar" | path with-parent $"(char psep)usr(char psep)share(char psep)"
|
|
assert equal $new_path $"(char psep)usr(char psep)share(char psep)foobar"
|
|
|
|
let new_path = [$"(char psep)home(char psep)rose(char psep)meow", $"(char psep)home(char psep)fdncred(char psep)"] | path with-parent $"(char psep)root(char psep)"
|
|
assert equal $new_path [$"(char psep)root(char psep)meow", $"(char psep)root(char psep)fdncred"]
|
|
}
|