Initial implementation of the random decimal subcommand. (#2762)

Co-authored-by: Stacy Maydew <stacy.maydew@starlab.io>
This commit is contained in:
smaydew
2020-11-24 02:19:48 -07:00
committed by GitHub
parent 8b597187fc
commit 5fb3df4054
6 changed files with 153 additions and 1 deletions

View 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'));
}

View File

@ -1,4 +1,5 @@
mod bool;
mod decimal;
mod dice;
mod integer;
#[cfg(feature = "uuid_crate")]