diff --git a/crates/nu-command/tests/commands/def.rs b/crates/nu-command/tests/commands/def.rs index 899b25a20c..d866419e1c 100644 --- a/crates/nu-command/tests/commands/def.rs +++ b/crates/nu-command/tests/commands/def.rs @@ -2,8 +2,6 @@ use nu_test_support::nu; use nu_test_support::playground::Playground; use std::fs; -// FIXME: jt: needs more work -#[ignore] #[test] fn def_with_comment() { Playground::setup("def_with_comment", |dirs, _| { @@ -14,7 +12,7 @@ def e [arg] {echo $arg} fs::write(dirs.root().join("def_test"), data).expect("Unable to write file"); let actual = nu!( cwd: dirs.root(), - "source def_test; help e | to json" + "source def_test; help e | to json -r" ); assert!(actual.out.contains("My echo\\n\\n")); diff --git a/crates/nu-command/tests/commands/flatten.rs b/crates/nu-command/tests/commands/flatten.rs index c2ff356794..ef14e058d8 100644 --- a/crates/nu-command/tests/commands/flatten.rs +++ b/crates/nu-command/tests/commands/flatten.rs @@ -2,8 +2,6 @@ use nu_test_support::fs::Stub::FileWithContentToBeTrimmed; use nu_test_support::playground::Playground; use nu_test_support::{nu, pipeline}; -// FIXME: jt: needs more work -#[ignore] #[test] fn flatten_nested_tables_with_columns() { let actual = nu!( @@ -11,7 +9,7 @@ fn flatten_nested_tables_with_columns() { r#" echo [[origin, people]; [Ecuador, ('Andres' | wrap name)]] [[origin, people]; [Nu, ('nuno' | wrap name)]] - | flatten + | flatten | flatten | get name | str collect ',' "# @@ -20,16 +18,14 @@ fn flatten_nested_tables_with_columns() { assert_eq!(actual.out, "Andres,nuno"); } -// FIXME: jt: needs more work -#[ignore] #[test] fn flatten_nested_tables_that_have_many_columns() { let actual = nu!( cwd: ".", pipeline( r#" echo [[origin, people]; [Ecuador, (echo [[name, meal]; ['Andres', 'arepa']])]] - [[origin, people]; [USA, (echo [[name, meal]; ['Katz', 'nurepa']])]] - | flatten + [[origin, people]; [USA, (echo [[name, meal]; ['Katz', 'nurepa']])]] + | flatten | flatten | get meal | str collect ',' "# diff --git a/crates/nu-command/tests/commands/move_/column.rs b/crates/nu-command/tests/commands/move_/column.rs index cc807e9f9f..94ad0ff24b 100644 --- a/crates/nu-command/tests/commands/move_/column.rs +++ b/crates/nu-command/tests/commands/move_/column.rs @@ -107,8 +107,6 @@ fn moves_a_column_after() { }) } -// FIXME: jt: needs more work -#[ignore] #[test] fn moves_columns_after() { Playground::setup("move_column_test_4", |dirs, sandbox| { @@ -132,7 +130,7 @@ fn moves_columns_after() { r#" open sample.csv | move letters and_more --after column1 - | get + | columns | select 1 2 | str collect "# diff --git a/crates/nu-command/tests/commands/path/exists.rs b/crates/nu-command/tests/commands/path/exists.rs index 0ab51ac939..9a1b496e04 100644 --- a/crates/nu-command/tests/commands/path/exists.rs +++ b/crates/nu-command/tests/commands/path/exists.rs @@ -2,8 +2,6 @@ use nu_test_support::fs::Stub::EmptyFile; use nu_test_support::nu; use nu_test_support::playground::Playground; -// FIXME: jt: needs more work -#[ignore] #[test] fn checks_if_existing_file_exists() { Playground::setup("path_exists_1", |dirs, sandbox| { diff --git a/crates/nu-command/tests/commands/path/type_.rs b/crates/nu-command/tests/commands/path/type_.rs index 76b6239936..040c77c987 100644 --- a/crates/nu-command/tests/commands/path/type_.rs +++ b/crates/nu-command/tests/commands/path/type_.rs @@ -15,8 +15,6 @@ fn returns_type_of_missing_file() { assert_eq!(actual.out, ""); } -// FIXME: jt: needs more work -#[ignore] #[test] fn returns_type_of_existing_file() { Playground::setup("path_expand_1", |dirs, sandbox| { @@ -36,8 +34,6 @@ fn returns_type_of_existing_file() { }) } -// FIXME: jt: needs more work -#[ignore] #[test] fn returns_type_of_existing_directory() { Playground::setup("path_expand_1", |dirs, sandbox| { diff --git a/crates/nu-command/tests/commands/reduce.rs b/crates/nu-command/tests/commands/reduce.rs index 95d428a515..3aba47e562 100644 --- a/crates/nu-command/tests/commands/reduce.rs +++ b/crates/nu-command/tests/commands/reduce.rs @@ -54,7 +54,7 @@ fn reduce_numbered_example() { cwd: ".", pipeline( r#" echo one longest three bar - reduce -n { |it, acc| if ($it | str length) > ($acc | str length) {echo $it} else {echo $acc}} + | reduce -n { |it, acc| if ($it.item | str length) > ($acc | str length) {echo $it.item} else {echo $acc}} | get index "# ) diff --git a/crates/nu-command/tests/commands/select.rs b/crates/nu-command/tests/commands/select.rs index 8881782294..f6364b35ee 100644 --- a/crates/nu-command/tests/commands/select.rs +++ b/crates/nu-command/tests/commands/select.rs @@ -106,8 +106,6 @@ fn column_names_with_spaces() { assert_eq!(actual.out, "Robalino Jnth"); } -// FIXME: jt: needs more work -#[ignore] #[test] fn ignores_duplicate_columns_selected() { let actual = nu!(cwd: ".", pipeline( @@ -119,7 +117,7 @@ fn ignores_duplicate_columns_selected() { [Andrés Jnth] ] | select "first name" "last name" "first name" - | get + | columns | str collect " " "# )); diff --git a/crates/nu-command/tests/commands/sort_by.rs b/crates/nu-command/tests/commands/sort_by.rs index cf21438583..87398661fe 100644 --- a/crates/nu-command/tests/commands/sort_by.rs +++ b/crates/nu-command/tests/commands/sort_by.rs @@ -21,8 +21,6 @@ fn by_column() { assert_eq!(actual.out, "description"); } -// FIXME: jt: needs more work -#[ignore] #[test] fn by_invalid_column() { let actual = nu!( @@ -41,8 +39,8 @@ fn by_invalid_column() { "# )); - assert!(actual.err.contains("Can not find column to sort by")); - assert!(actual.err.contains("invalid column")); + assert!(actual.err.contains("Cannot find column")); + assert!(actual.err.contains("value originates here")); } // FIXME: jt: needs more work @@ -53,15 +51,14 @@ fn by_invalid_types() { cwd: "tests/fixtures/formats", pipeline( r#" open cargo_sample.toml --raw - | echo [1 "foo"] + | echo ["foo" 1] | sort-by + | json -r "# )); - assert!(actual.err.contains("Not all values can be compared")); - assert!(actual - .err - .contains("Unable to sort values, as \"integer\" cannot compare against \"string\"")); + let json_output = r#"[1,"foo"]"#; + assert_eq!(actual.out, json_output); } #[test] @@ -93,7 +90,6 @@ fn ls_sort_by_name_sensitive() { "# )); - //let json_output = r#"[{"name":"B.txt"},{"name":"C"},{"name":"a.txt"}]"#; let json_output = r#"[{"name": "B.txt"},{"name": "C"},{"name": "a.txt"}]"#; assert_eq!(actual.out, json_output); diff --git a/crates/nu-command/tests/commands/source.rs b/crates/nu-command/tests/commands/source.rs index dcc342d832..8a15a3ec14 100644 --- a/crates/nu-command/tests/commands/source.rs +++ b/crates/nu-command/tests/commands/source.rs @@ -101,8 +101,6 @@ fn try_source_foo_without_quotes_in(testdir: &str, playdir: &str) { }); } -// FIXME: jt: needs more work -#[ignore] #[test] fn sources_unicode_file_in_normal_dir() { try_source_foo_with_single_quotes_in("foo", "source_test_1"); @@ -110,8 +108,6 @@ fn sources_unicode_file_in_normal_dir() { try_source_foo_without_quotes_in("foo", "source_test_3"); } -// FIXME: jt: needs more work -#[ignore] #[test] fn sources_unicode_file_in_unicode_dir_without_spaces_1() { try_source_foo_with_single_quotes_in("🚒", "source_test_4"); @@ -119,8 +115,6 @@ fn sources_unicode_file_in_unicode_dir_without_spaces_1() { try_source_foo_without_quotes_in("🚒", "source_test_6"); } -// FIXME: jt: needs more work -#[ignore] #[cfg(not(windows))] // ':' is not allowed in Windows paths #[test] fn sources_unicode_file_in_unicode_dir_without_spaces_2() { diff --git a/crates/nu-command/tests/commands/with_env.rs b/crates/nu-command/tests/commands/with_env.rs index 32d9d4f22d..8ea9ba22bc 100644 --- a/crates/nu-command/tests/commands/with_env.rs +++ b/crates/nu-command/tests/commands/with_env.rs @@ -65,8 +65,6 @@ fn test_redirection2() { assert_eq!(actual.out, "10"); } -// FIXME: jt: needs more work -#[ignore] #[test] fn with_env_hides_variables_in_parent_scope() { let actual = nu!( @@ -82,8 +80,6 @@ fn with_env_hides_variables_in_parent_scope() { ); assert_eq!(actual.out, "11"); - assert!(actual.err.contains("error")); - assert!(actual.err.contains("Unknown column")); } // FIXME: jt: needs more work diff --git a/crates/nu-command/tests/commands/zip.rs b/crates/nu-command/tests/commands/zip.rs index 23470f05a5..515d657753 100644 --- a/crates/nu-command/tests/commands/zip.rs +++ b/crates/nu-command/tests/commands/zip.rs @@ -5,25 +5,13 @@ use nu_test_support::{nu, pipeline}; const ZIP_POWERED_TEST_ASSERTION_SCRIPT: &str = r#" def expect [ left, - right, - --to-eq + --to-eq, + right ] { - $left | zip { $right } | all? { - $it.name.0 == $it.name.1 && $it.commits.0 == $it.commits.1 + $left | zip { $right } | all? {|row| + $row.name.0 == $row.name.1 && $row.commits.0 == $row.commits.1 } } - -def add-commits [n] { - each { - let contributor = $it; - let name = $it.name; - let commits = $it.commits; - - $contributor | merge { - [[commits]; [($commits + $n)]] - } - } -} "#; // FIXME: jt: needs more work @@ -48,7 +36,7 @@ fn zips_two_tables() { [ jt, 20] ]); - let actual = ($contributors | add-commits 10); + let actual = ($contributors | update commits {{ |i| ($i.commits + 10) }}); expect $actual --to-eq [[name, commits]; [andres, 20] [jt, 30]] "#,