forked from extern/nushell
.cargo
.github
assets
crates
nu-cli
nu-color-config
nu-command
assets
src
tests
commands
date
hash_
math
move_
network
path
basename.rs
dirname.rs
exists.rs
expand.rs
join.rs
mod.rs
parse.rs
split.rs
type_.rs
query
random
skip
str_
take
alias.rs
all.rs
any.rs
append.rs
cal.rs
cd.rs
compact.rs
cp.rs
def.rs
default.rs
do_.rs
drop.rs
each.rs
echo.rs
empty.rs
enter.rs
error_make.rs
every.rs
find.rs
first.rs
flatten.rs
format.rs
get.rs
group_by.rs
headers.rs
help.rs
histogram.rs
insert.rs
into_filesize.rs
into_int.rs
last.rs
length.rs
let_.rs
lines.rs
ls.rs
merge.rs
mkdir.rs
mod.rs
nu_check.rs
open.rs
parse.rs
prepend.rs
print.rs
range.rs
reduce.rs
reject.rs
rename.rs
reverse.rs
rm.rs
roll.rs
rotate.rs
run_external.rs
save.rs
select.rs
semicolon.rs
sort_by.rs
source.rs
split_by.rs
split_column.rs
split_row.rs
touch.rs
transpose.rs
uniq.rs
update.rs
upsert.rs
use_.rs
where_.rs
which.rs
with_env.rs
wrap.rs
zip.rs
format_conversions
main.rs
Cargo.toml
LICENSE
build.rs
nu-engine
nu-glob
nu-json
nu-parser
nu-path
nu-plugin
nu-pretty-hex
nu-protocol
nu-system
nu-table
nu-term-grid
nu-test-support
nu-utils
nu_plugin_custom_values
nu_plugin_example
nu_plugin_gstat
nu_plugin_inc
nu_plugin_python
nu_plugin_query
old
README.md
docker
docs
images
pkg_mgrs
samples
src
tests
wix
.gitignore
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Cargo.lock
Cargo.toml
LICENSE
README.md
README.release.txt
build-all-maclin.sh
build-all-windows.cmd
build-all.nu
build.rs
install-all.ps1
install-all.sh
uninstall-all.sh
49 lines
945 B
Rust
49 lines
945 B
Rust
use nu_test_support::{nu, pipeline};
|
|
|
|
#[test]
|
|
fn splits_empty_path() {
|
|
let actual = nu!(
|
|
cwd: "tests", pipeline(
|
|
r#"
|
|
echo '' | path split
|
|
"#
|
|
));
|
|
|
|
assert_eq!(actual.out, "");
|
|
}
|
|
|
|
#[test]
|
|
fn splits_correctly_single_path() {
|
|
let actual = nu!(
|
|
cwd: "tests", pipeline(
|
|
r#"
|
|
'home/viking/spam.txt'
|
|
| path split
|
|
| last
|
|
"#
|
|
));
|
|
|
|
assert_eq!(actual.out, "spam.txt");
|
|
}
|
|
|
|
#[test]
|
|
fn splits_correctly_with_column_path() {
|
|
let actual = nu!(
|
|
cwd: "tests", pipeline(
|
|
r#"
|
|
echo [
|
|
[home, barn];
|
|
|
|
['home/viking/spam.txt', 'barn/cow/moo.png']
|
|
['home/viking/eggs.txt', 'barn/goat/cheese.png']
|
|
]
|
|
| path split -c [ home barn ]
|
|
| get barn
|
|
| flatten
|
|
| length
|
|
"#
|
|
));
|
|
|
|
assert_eq!(actual.out, "6");
|
|
}
|