mirror of
https://github.com/nushell/nushell.git
synced 2025-08-16 06:07:52 +02:00
Allow the calculation of bytes and int. (#2160)
* Allow the calculation of bytes and int. * fix clippy. * minimal implement the into_into command. * Revert "fix clippy." This reverts commit0d7cf72ed2
. * Revert "Allow the calculation of bytes and int." This reverts commit9c4e3787f5
. * set the argument to any type. * if the argument is an int, return it with no change in value. * add tests for into-int command. * fix a faild test.
This commit is contained in:
25
crates/nu-cli/tests/commands/into_int.rs
Normal file
25
crates/nu-cli/tests/commands/into_int.rs
Normal file
@ -0,0 +1,25 @@
|
||||
use nu_test_support::{nu, pipeline};
|
||||
|
||||
#[test]
|
||||
fn into_int_filesize() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
into-int 1kb | = $it / 1024
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.contains("1"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn into_int_int() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
into-int 1024 | = $it / 1024
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.contains("1"));
|
||||
}
|
Reference in New Issue
Block a user