a few more tests (#941)

This commit is contained in:
Darren Schroeder 2022-02-04 15:42:18 -06:00 committed by GitHub
parent f29dbeddd7
commit b26acf97bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 15 deletions

View file

@ -1,13 +1,11 @@
use nu_test_support::{nu, pipeline}; use nu_test_support::{nu, pipeline};
// FIXME: jt: needs more work
#[ignore]
#[test] #[test]
fn each_works_separately() { fn each_works_separately() {
let actual = nu!( let actual = nu!(
cwd: "tests/fixtures/formats", pipeline( cwd: "tests/fixtures/formats", pipeline(
r#" r#"
echo [1 2 3] | each { echo $it 10 | math sum } | to json echo [1 2 3] | each { echo $it 10 | math sum } | to json -r
"# "#
)); ));
@ -56,18 +54,16 @@ fn each_window_stride() {
assert_eq!(actual.out, "[[1,2,3],[3,4,5]]"); assert_eq!(actual.out, "[[1,2,3],[3,4,5]]");
} }
// FIXME: jt: needs more work
#[ignore]
#[test] #[test]
fn each_no_args_in_block() { fn each_no_args_in_block() {
let actual = nu!( let actual = nu!(
cwd: "tests/fixtures/formats", pipeline( cwd: "tests/fixtures/formats", pipeline(
r#" r#"
echo [[foo bar]; [a b] [c d] [e f]] | each { to json } | nth 1 | str collect echo [[foo bar]; [a b] [c d] [e f]] | each {|i| $i | to json -r } | nth 1
"# "#
)); ));
assert_eq!(actual.out, r#"{"foo":"c","bar":"d"}"#); assert_eq!(actual.out, r#"{"foo": "c","bar": "d"}"#);
} }
#[test] #[test]

View file

@ -259,30 +259,26 @@ fn compound_comparison2() {
assert_eq!(actual.out, "true"); assert_eq!(actual.out, "true");
} }
// FIXME: jt: needs more work
#[ignore]
#[test] #[test]
fn compound_where() { fn compound_where() {
let actual = nu!( let actual = nu!(
cwd: "tests/fixtures/formats", pipeline( cwd: "tests/fixtures/formats", pipeline(
r#" r#"
echo '[{"a": 1, "b": 1}, {"a": 2, "b": 1}, {"a": 2, "b": 2}]' | from json | where a == 2 && b == 1 | to json 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}"#); assert_eq!(actual.out, r#"[{"a": 2,"b": 1}]"#);
} }
// FIXME: jt: needs more work
#[ignore]
#[test] #[test]
fn compound_where_paren() { fn compound_where_paren() {
let actual = nu!( let actual = nu!(
cwd: "tests/fixtures/formats", pipeline( cwd: "tests/fixtures/formats", pipeline(
r#" r#"
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 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}]"#); assert_eq!(actual.out, r#"[{"a": 2,"b": 1},{"a": 2,"b": 2}]"#);
} }