engine-q merge

This commit is contained in:
Fernando Herrera
2022-02-07 19:11:34 +00:00
1965 changed files with 119062 additions and 20 deletions

View File

@ -18,8 +18,15 @@ fn can_average_numbers() {
fn can_average_bytes() {
let actual = nu!(
cwd: "tests/fixtures/formats",
<<<<<<< HEAD
"ls | sort-by name | skip 1 | first 2 | get size | math avg | format \"{$it}\" "
);
assert_eq!(actual.out, "1.6 KB");
=======
"ls | sort-by name | skip 1 | first 2 | get size | math avg | to json -r"
);
assert_eq!(actual.out, "1600");
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
}

View File

@ -1,5 +1,10 @@
use nu_test_support::{nu, pipeline};
<<<<<<< HEAD
=======
// FIXME: jt: needs more work
#[ignore]
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
#[test]
fn evaluates_two_plus_two() {
let actual = nu!(
@ -12,6 +17,11 @@ fn evaluates_two_plus_two() {
assert!(actual.out.contains("4.0"));
}
<<<<<<< HEAD
=======
// FIXME: jt: needs more work
#[ignore]
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
#[test]
fn evaluates_two_to_the_power_four() {
let actual = nu!(
@ -24,6 +34,11 @@ fn evaluates_two_to_the_power_four() {
assert!(actual.out.contains("16.0"));
}
<<<<<<< HEAD
=======
// FIXME: jt: needs more work
#[ignore]
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
#[test]
fn evaluates_three_multiplied_by_five() {
let actual = nu!(
@ -36,6 +51,11 @@ fn evaluates_three_multiplied_by_five() {
assert!(actual.out.contains("15.0"));
}
<<<<<<< HEAD
=======
// FIXME: jt: needs more work
#[ignore]
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
#[test]
fn evaluates_twenty_four_divided_by_two() {
let actual = nu!(

View File

@ -1,40 +0,0 @@
use nu_test_support::{nu, pipeline};
#[test]
fn median_numbers_with_even_rows() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo [10 6 19 21 4]
| math median
"#
));
assert_eq!(actual.out, "10")
}
#[test]
fn median_numbers_with_odd_rows() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo [3 8 9 12 12 15]
| math median
"#
));
assert_eq!(actual.out, "10.5")
}
#[test]
fn median_mixed_numbers() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo [-11.5 -13.5 10]
| math median
"#
));
assert_eq!(actual.out, "-11.5")
}

View File

@ -236,6 +236,7 @@ fn duration_math_with_negative() {
}
#[test]
<<<<<<< HEAD
fn duration_math_shell_error_on_big_numbers() {
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
@ -248,6 +249,8 @@ fn duration_math_shell_error_on_big_numbers() {
}
#[test]
=======
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
fn compound_comparison() {
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
@ -276,11 +279,19 @@ fn compound_where() {
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
r#"
<<<<<<< HEAD
echo '[{"a": 1, "b": 1}, {"a": 2, "b": 1}, {"a": 2, "b": 2}]' | from json | where a == 2 && b == 1 | to json
"#
));
assert_eq!(actual.out, r#"{"a":2,"b":1}"#);
=======
echo '[{"a": 1, "b": 1}, {"a": 2, "b": 1}, {"a": 2, "b": 2}]' | from json | where a == 2 && b == 1 | to json -r
"#
));
assert_eq!(actual.out, r#"[{"a": 2,"b": 1}]"#);
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
}
#[test]
@ -288,9 +299,17 @@ fn compound_where_paren() {
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
r#"
<<<<<<< HEAD
echo '[{"a": 1, "b": 1}, {"a": 2, "b": 1}, {"a": 2, "b": 2}]' | from json | where ($it.a == 2 && $it.b == 1) || $it.b == 2 | to json
"#
));
assert_eq!(actual.out, r#"[{"a":2,"b":1},{"a":2,"b":2}]"#);
=======
echo '[{"a": 1, "b": 1}, {"a": 2, "b": 1}, {"a": 2, "b": 2}]' | from json | where ($it.a == 2 && $it.b == 1) || $it.b == 2 | to json -r
"#
));
assert_eq!(actual.out, r#"[{"a": 2,"b": 1},{"a": 2,"b": 2}]"#);
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
}

View File

@ -1,21 +0,0 @@
use nu_test_support::nu;
#[test]
fn can_round_very_large_numbers() {
let actual = nu!(
cwd: ".",
"echo 18.1372544780074142289927665486772012345 | math round"
);
assert_eq!(actual.out, "18")
}
#[test]
fn can_round_very_large_numbers_with_precision() {
let actual = nu!(
cwd: ".",
"echo 18.13725447800741422899276654867720121457878988 | math round -p 10"
);
assert_eq!(actual.out, "18.137254478")
}

View File

@ -1,5 +1,10 @@
use nu_test_support::nu;
<<<<<<< HEAD
=======
// FIXME: jt: needs more work
#[ignore]
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
#[test]
fn can_sqrt_numbers() {
let actual = nu!(
@ -10,6 +15,11 @@ fn can_sqrt_numbers() {
assert_eq!(actual.out, "3.914213562373095048801688724209698078569671875376948073176679737990732478462107038850387534327641573");
}
<<<<<<< HEAD
=======
// FIXME: jt: needs more work
#[ignore]
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
#[test]
fn can_sqrt_irrational() {
let actual = nu!(

View File

@ -75,6 +75,11 @@ fn compute_sum_of_table() -> Result<(), String> {
Ok(())
}
<<<<<<< HEAD
=======
// FIXME: jt: needs more work
#[ignore]
>>>>>>> 9259a56a28f1dd3a4b720ad815aa19c6eaf6adce
#[test]
fn sum_of_a_row_containing_a_table_is_an_error() {
let actual = nu!(