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
```
This commit is contained in:
Solomon
2024-10-12 06:49:05 +00:00
committed by GitHub
parent e32e55938b
commit d83781ddec
5 changed files with 55 additions and 7 deletions

View File

@ -9,3 +9,13 @@ fn generates_chars_of_specified_length() {
let result = actual.out;
assert_eq!(result, "15");
}
#[test]
fn generates_chars_of_specified_filesize() {
let actual = nu!(r#"
random chars --length 1kb | str stats | get bytes
"#);
let result = actual.out;
assert_eq!(result, "1000");
}