mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 13:06:08 +02:00
Update internal use of decimal
to float
(#10333)
# Description We made the decision that our floating point type should be referred to as `float` over `decimal`. Commands were updated by #9979 and #10320 Now make the internal codebase consistent in referring to this data type as `float`. Work for #10332 # User-Facing Changes `decimal` has been removed as a type name/symbol. Instead of ```nushell def foo [bar: decimal] decimal -> decimal {} ``` use ```nushell def foo [bar: float] float -> float {} ``` Potential effect of `SyntaxShape`'s `Display` implementation now also referring to `float` instead of `decimal` # Details - Rename `SyntaxShape::Decimal` to `Float` - Update `Display for SyntaxShape` to `float` - Update error message + fn name in dataframe code - Fix docs in command examples - Rename tests that are float specific - Update doccomment on `SyntaxShape` - Update comment in script # Tests + Formatting Updates the names of some tests
This commit is contained in:
committed by
GitHub
parent
5bd7300cd5
commit
bbf0b45c59
@ -8,7 +8,7 @@ fn into_filesize_int() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn into_filesize_decimal() {
|
||||
fn into_filesize_float() {
|
||||
let actual = nu!("1.2 | into filesize");
|
||||
|
||||
assert!(actual.out.contains("1 B"));
|
||||
|
@ -117,7 +117,7 @@ fn error_zero_division_int_int() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn error_zero_division_decimal_int() {
|
||||
fn error_zero_division_float_int() {
|
||||
let actual = nu!(pipeline(
|
||||
r#"
|
||||
1.0 / 0
|
||||
@ -128,7 +128,7 @@ fn error_zero_division_decimal_int() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn error_zero_division_int_decimal() {
|
||||
fn error_zero_division_int_float() {
|
||||
let actual = nu!(pipeline(
|
||||
r#"
|
||||
1 / 0.0
|
||||
@ -139,7 +139,7 @@ fn error_zero_division_int_decimal() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn error_zero_division_decimal_decimal() {
|
||||
fn error_zero_division_float_float() {
|
||||
let actual = nu!(pipeline(
|
||||
r#"
|
||||
1.0 / 0.0
|
||||
@ -194,7 +194,7 @@ fn error_zero_floor_division_int_int() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn error_zero_floor_division_decimal_int() {
|
||||
fn error_zero_floor_division_float_int() {
|
||||
let actual = nu!(pipeline(
|
||||
r#"
|
||||
1.0 // 0
|
||||
@ -205,7 +205,7 @@ fn error_zero_floor_division_decimal_int() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn error_zero_floor_division_int_decimal() {
|
||||
fn error_zero_floor_division_int_float() {
|
||||
let actual = nu!(pipeline(
|
||||
r#"
|
||||
1 // 0.0
|
||||
@ -216,7 +216,7 @@ fn error_zero_floor_division_int_decimal() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn error_zero_floor_division_decimal_decimal() {
|
||||
fn error_zero_floor_division_float_float() {
|
||||
let actual = nu!(pipeline(
|
||||
r#"
|
||||
1.0 // 0.0
|
||||
|
@ -21,7 +21,7 @@ fn from_number() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn from_decimal() {
|
||||
fn from_float() {
|
||||
let actual = nu!(r#"
|
||||
echo 1.5 | into string
|
||||
"#);
|
||||
@ -90,7 +90,7 @@ fn from_filesize() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn from_decimal_correct_trailing_zeros() {
|
||||
fn from_float_correct_trailing_zeros() {
|
||||
let actual = nu!(r#"
|
||||
1.23000 | into string -d 3
|
||||
"#);
|
||||
@ -99,7 +99,7 @@ fn from_decimal_correct_trailing_zeros() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn from_int_decimal_correct_trailing_zeros() {
|
||||
fn from_int_float_correct_trailing_zeros() {
|
||||
let actual = nu!(r#"
|
||||
1.00000 | into string -d 3
|
||||
"#);
|
||||
@ -108,7 +108,7 @@ fn from_int_decimal_correct_trailing_zeros() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn from_int_decimal_trim_trailing_zeros() {
|
||||
fn from_int_float_trim_trailing_zeros() {
|
||||
let actual = nu!(r#"
|
||||
1.00000 | into string | $"($in) flat"
|
||||
"#);
|
||||
|
@ -135,7 +135,7 @@ fn converts_to_int() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn converts_to_decimal() {
|
||||
fn converts_to_float() {
|
||||
let actual = nu!(pipeline(
|
||||
r#"
|
||||
echo "3.1, 0.0415"
|
||||
|
Reference in New Issue
Block a user