nushell/crates/nu-command/tests/commands/path/type_.rs
JT a008f1aa80
Command tests (#922)
* WIP command tests

* Finish marking todo tests

* update

* update

* Windows cd test ignoring
2022-02-03 21:01:45 -05:00

59 lines
1.2 KiB
Rust

use nu_test_support::fs::Stub::EmptyFile;
use nu_test_support::playground::Playground;
use nu_test_support::{nu, pipeline};
#[test]
fn returns_type_of_missing_file() {
let actual = nu!(
cwd: "tests", pipeline(
r#"
echo "spam.txt"
| path type
"#
));
assert_eq!(actual.out, "");
}
// FIXME: jt: needs more work
#[ignore]
#[test]
fn returns_type_of_existing_file() {
Playground::setup("path_expand_1", |dirs, sandbox| {
sandbox
.within("menu")
.with_files(vec![EmptyFile("spam.txt")]);
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
echo "menu"
| path type
"#
));
assert_eq!(actual.out, "dir");
})
}
// FIXME: jt: needs more work
#[ignore]
#[test]
fn returns_type_of_existing_directory() {
Playground::setup("path_expand_1", |dirs, sandbox| {
sandbox
.within("menu")
.with_files(vec![EmptyFile("spam.txt")]);
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
echo "menu/spam.txt"
| path type
"#
));
assert_eq!(actual.out, "file");
})
}