2020-08-27 05:44:18 +00:00
|
|
|
use nu_test_support::{nu, pipeline};
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn into_int_filesize() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
2021-04-09 14:17:39 +00:00
|
|
|
echo 1kb | into int | each {= $it / 1000 }
|
2021-02-10 02:31:12 +00:00
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert!(actual.out.contains('1'));
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn into_int_filesize2() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
2021-04-09 14:17:39 +00:00
|
|
|
echo 1kib | into int | each {= $it / 1024 }
|
2020-08-27 05:44:18 +00:00
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
2020-10-08 21:47:51 +00:00
|
|
|
assert!(actual.out.contains('1'));
|
2020-08-27 05:44:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn into_int_int() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
2021-04-09 14:17:39 +00:00
|
|
|
echo 1024 | into int | each {= $it / 1024 }
|
2020-08-27 05:44:18 +00:00
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
2020-10-08 21:47:51 +00:00
|
|
|
assert!(actual.out.contains('1'));
|
2020-08-27 05:44:18 +00:00
|
|
|
}
|