Rename random decimal to random float (#10320)

# Description
Similar to #9979

# User-Facing Changes
`random decimal` will now raise a warning and can be removed in an
upcoming release.

New command is named `random float`

# Tests + Formatting
Tests updated and improved.
This commit is contained in:
Stefan Holderbach
2023-09-12 13:03:05 +02:00
committed by GitHub
parent 1fb4f9e455
commit d53b0a99d0
7 changed files with 171 additions and 28 deletions

View File

@ -0,0 +1,26 @@
use nu_test_support::nu;
#[test]
fn generates_a_float() {
let actual = nu!("random float 42..43");
// Attention: this relies on the string output
assert!(actual.out.starts_with("42") || actual.out.starts_with("43"));
let actual = nu!("random float 42..43 | describe");
assert_eq!(actual.out, "float")
}
#[test]
fn generates_55() {
let actual = nu!("random float 55..55");
assert!(actual.out.contains("55"));
}
#[test]
fn generates_0() {
let actual = nu!("random float ..<1");
assert!(actual.out.contains('0'));
}