forked from extern/nushell
Improve expr parse (#3584)
* Require '-' to be a number for math * Add test * improve parse logic, add test
This commit is contained in:
@ -618,6 +618,29 @@ fn index_out_of_bounds() {
|
||||
assert!(actual.err.contains("unknown row"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dash_def() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
def - [x, y] { $x - $y }; - 4 1
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "3");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn negative_decimal_start() {
|
||||
let actual = nu!(
|
||||
cwd: ".",
|
||||
r#"
|
||||
-1.3 + 4
|
||||
"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "2.7");
|
||||
}
|
||||
#[test]
|
||||
fn index_row() {
|
||||
let actual = nu!(
|
||||
|
Reference in New Issue
Block a user