nushell/crates/nu-command/tests/commands/random/binary.rs
Solomon d83781ddec
support filesize arguments in random binary/chars (#14068)
Closes #13920

# User-Facing Changes

`random binary` and `random chars` now support filesize arguments:

```nushell
random binary 1kb
random chars --length 1kb
```
2024-10-12 14:49:05 +08:00

22 lines
414 B
Rust

use nu_test_support::nu;
#[test]
fn generates_bytes_of_specified_length() {
let actual = nu!(r#"
random binary 16 | bytes length
"#);
let result = actual.out;
assert_eq!(result, "16");
}
#[test]
fn generates_bytes_of_specified_filesize() {
let actual = nu!(r#"
random binary 1kb | bytes length
"#);
let result = actual.out;
assert_eq!(result, "1000");
}