forked from extern/nushell
Command tests (#922)
* WIP command tests * Finish marking todo tests * update * update * Windows cd test ignoring
This commit is contained in:
80
crates/nu-command/tests/commands/into_filesize.rs
Normal file
80
crates/nu-command/tests/commands/into_filesize.rs
Normal file
@ -0,0 +1,80 @@
|
||||
use nu_test_support::{nu, pipeline};
|
||||
|
||||
#[test]
|
||||
fn into_filesize_int() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
1 | into filesize
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.contains("1 B"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn into_filesize_decimal() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
1.2 | into filesize
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.contains("1 B"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn into_filesize_str() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
'2000' | into filesize
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.contains("2.0 KiB"));
|
||||
}
|
||||
|
||||
// FIXME: jt: needs more work
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn into_filesize_str_newline() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
"2000
|
||||
" | into filesize
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.contains("2.0 KiB"));
|
||||
}
|
||||
|
||||
// FIXME: jt: needs more work
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn into_filesize_str_many_newlines() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
"2000
|
||||
|
||||
" | into filesize
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.contains("2.0 KiB"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn into_filesize_filesize() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
3kib | into filesize
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.contains("3.0 KiB"));
|
||||
}
|
Reference in New Issue
Block a user