mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 06:38:43 +02:00
Initial implementation of the random decimal subcommand. (#2762)
Co-authored-by: Stacy Maydew <stacy.maydew@starlab.io>
This commit is contained in:
37
crates/nu-cli/tests/commands/random/decimal.rs
Normal file
37
crates/nu-cli/tests/commands/random/decimal.rs
Normal file
@ -0,0 +1,37 @@
|
||||
use nu_test_support::{nu, pipeline};
|
||||
|
||||
#[test]
|
||||
fn generates_an_decimal() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
random decimal 42..43
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.contains("42") || actual.out.contains("43"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn generates_55() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
random decimal 55..55
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.contains("55"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn generates_0() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
random decimal ..<1
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.contains('0'));
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
mod bool;
|
||||
mod decimal;
|
||||
mod dice;
|
||||
mod integer;
|
||||
#[cfg(feature = "uuid_crate")]
|
||||
|
Reference in New Issue
Block a user