mirror of
https://github.com/nushell/nushell.git
synced 2024-12-03 13:53:59 +01:00
556596bce8
* add 'int' command * create `into int` behavior - forcibly overwrote prior implementation ```sh git mv -f crates/nu-command/src/commands/int_.rs crates/nu-command/src/commands/into_int.rs ``` - picked up prior work, polished and renamed Co-authored-by: Saeed Rasooli <saeed.gnu@gmail.com>
38 lines
659 B
Rust
38 lines
659 B
Rust
use nu_test_support::{nu, pipeline};
|
|
|
|
#[test]
|
|
fn into_int_filesize() {
|
|
let actual = nu!(
|
|
cwd: ".", pipeline(
|
|
r#"
|
|
echo 1kb | into int | each {= $it / 1000 }
|
|
"#
|
|
));
|
|
|
|
assert!(actual.out.contains('1'));
|
|
}
|
|
|
|
#[test]
|
|
fn into_int_filesize2() {
|
|
let actual = nu!(
|
|
cwd: ".", pipeline(
|
|
r#"
|
|
echo 1kib | into int | each {= $it / 1024 }
|
|
"#
|
|
));
|
|
|
|
assert!(actual.out.contains('1'));
|
|
}
|
|
|
|
#[test]
|
|
fn into_int_int() {
|
|
let actual = nu!(
|
|
cwd: ".", pipeline(
|
|
r#"
|
|
echo 1024 | into int | each {= $it / 1024 }
|
|
"#
|
|
));
|
|
|
|
assert!(actual.out.contains('1'));
|
|
}
|