From 75180d07de6cea4ea8966c5eb17522e0bfa0edb5 Mon Sep 17 00:00:00 2001 From: Vikrant A P <42289399+hexavik@users.noreply.github.com> Date: Fri, 21 Jul 2023 21:02:37 +0530 Subject: [PATCH] Fix: remove unnecessary `r#"..."#` (#8670) (#9764) # Description This PR is related to **Tests: clean up unnecessary use of cwd, pipeline(), etc. [#8670](https://github.com/nushell/nushell/issues/8670)** - Removed the `r#"..."#` raw string literal syntax, which is unnecessary when there are no special characters that need quoting from the tests that use the `nu!` macro. - `cwd:` and `pipeline()` has not changed # User-Facing Changes # Tests + Formatting # After Submitting --- crates/nu-command/tests/commands/def.rs | 2 +- crates/nu-command/tests/commands/do_.rs | 8 +- crates/nu-command/tests/commands/flatten.rs | 4 +- crates/nu-command/tests/commands/for_.rs | 16 ++-- crates/nu-command/tests/commands/format.rs | 4 +- crates/nu-command/tests/commands/get.rs | 2 +- crates/nu-command/tests/commands/group_by.rs | 4 +- crates/nu-command/tests/commands/headers.rs | 32 +++---- crates/nu-command/tests/commands/histogram.rs | 8 +- crates/nu-command/tests/commands/insert.rs | 20 ++-- .../tests/commands/into_filesize.rs | 16 +--- crates/nu-command/tests/commands/into_int.rs | 16 +--- crates/nu-command/tests/commands/lines.rs | 8 +- crates/nu-command/tests/commands/loop_.rs | 12 +-- crates/nu-command/tests/commands/ls.rs | 70 +++++++------- crates/nu-command/tests/commands/match_.rs | 6 +- crates/nu-command/tests/commands/merge.rs | 24 ++--- crates/nu-command/tests/commands/mkdir.rs | 4 +- crates/nu-command/tests/commands/mut_.rs | 56 +++-------- crates/nu-command/tests/commands/nu_check.rs | 92 +++++++++---------- crates/nu-command/tests/commands/open.rs | 40 ++++---- crates/nu-command/tests/commands/par_each.rs | 2 +- crates/nu-command/tests/commands/range.rs | 12 +-- .../nu-command/tests/commands/redirection.rs | 14 +-- crates/nu-command/tests/commands/reduce.rs | 38 +++----- crates/nu-command/tests/commands/rename.rs | 8 +- crates/nu-command/tests/commands/return_.rs | 12 +-- crates/nu-command/tests/commands/rm.rs | 2 +- crates/nu-command/tests/commands/roll.rs | 20 ++-- .../nu-command/tests/commands/run_external.rs | 18 ++-- crates/nu-command/tests/commands/save.rs | 8 +- crates/nu-command/tests/commands/select.rs | 8 +- crates/nu-command/tests/commands/sort.rs | 4 +- crates/nu-command/tests/commands/sort_by.rs | 16 ++-- .../nu-command/tests/commands/source_env.rs | 8 +- crates/nu-command/tests/commands/split_by.rs | 4 +- crates/nu-command/tests/commands/table.rs | 39 ++++---- crates/nu-command/tests/commands/touch.rs | 4 +- crates/nu-command/tests/commands/uniq.rs | 16 ++-- crates/nu-command/tests/commands/uniq_by.rs | 24 ++--- crates/nu-command/tests/commands/update.rs | 4 +- crates/nu-command/tests/commands/upsert.rs | 6 +- crates/nu-command/tests/commands/use_.rs | 8 +- crates/nu-command/tests/commands/where_.rs | 28 +++--- crates/nu-command/tests/commands/wrap.rs | 8 +- crates/nu-command/tests/commands/zip.rs | 4 +- 46 files changed, 341 insertions(+), 418 deletions(-) diff --git a/crates/nu-command/tests/commands/def.rs b/crates/nu-command/tests/commands/def.rs index 645217e0d..65d5d58db 100644 --- a/crates/nu-command/tests/commands/def.rs +++ b/crates/nu-command/tests/commands/def.rs @@ -109,7 +109,7 @@ fn def_fails_with_invalid_name() { let actual = nu!(r#"def 5gib = echo "test""#); assert!(actual.err.contains(err_msg)); - let actual = nu!(r#"def ^foo [] {}"#); + let actual = nu!("def ^foo [] {}"); assert!(actual.err.contains(err_msg)); } diff --git a/crates/nu-command/tests/commands/do_.rs b/crates/nu-command/tests/commands/do_.rs index 809b1e6da..c4aa96282 100644 --- a/crates/nu-command/tests/commands/do_.rs +++ b/crates/nu-command/tests/commands/do_.rs @@ -136,17 +136,13 @@ fn capture_error_with_both_stdout_stderr_messages_not_hang_nushell() { // check for stdout let actual = nu!( cwd: dirs.test(), pipeline( - r#" - do -c {bash test.sh} | complete | get stdout | str trim - "#, + "do -c {bash test.sh} | complete | get stdout | str trim", )); assert_eq!(actual.out, expect_body); // check for stderr let actual = nu!( cwd: dirs.test(), pipeline( - r#" - do -c {bash test.sh} | complete | get stderr | str trim - "#, + "do -c {bash test.sh} | complete | get stderr | str trim", )); assert_eq!(actual.out, expect_body); }, diff --git a/crates/nu-command/tests/commands/flatten.rs b/crates/nu-command/tests/commands/flatten.rs index 1a175e7bf..e9d9611fb 100644 --- a/crates/nu-command/tests/commands/flatten.rs +++ b/crates/nu-command/tests/commands/flatten.rs @@ -35,9 +35,7 @@ fn flatten_nested_tables_that_have_many_columns() { #[test] fn flatten_nested_tables() { let actual = nu!(pipeline( - r#" - echo [[Andrés, Nicolás, Robalino]] | flatten | get 1 - "# + "echo [[Andrés, Nicolás, Robalino]] | flatten | get 1" )); assert_eq!(actual.out, "Nicolás"); diff --git a/crates/nu-command/tests/commands/for_.rs b/crates/nu-command/tests/commands/for_.rs index 76dc71cfb..cd3cabfff 100644 --- a/crates/nu-command/tests/commands/for_.rs +++ b/crates/nu-command/tests/commands/for_.rs @@ -2,10 +2,10 @@ use nu_test_support::nu; #[test] fn for_doesnt_auto_print_in_each_iteration() { - let actual = nu!(r#" + let actual = nu!(" for i in 1..2 { echo 1 - }"#); + }"); // Make sure we don't see any of these values in the output // As we do not auto-print loops anymore assert!(!actual.out.contains('1')); @@ -13,11 +13,11 @@ fn for_doesnt_auto_print_in_each_iteration() { #[test] fn for_break_on_external_failed() { - let actual = nu!(r#" + let actual = nu!(" for i in 1..2 { print 1; nu --testbin fail - }"#); + }"); // Note: nu! macro auto replace "\n" and "\r\n" with "" // so our output will be `1` assert_eq!(actual.out, "1"); @@ -25,18 +25,18 @@ fn for_break_on_external_failed() { #[test] fn failed_for_should_break_running() { - let actual = nu!(r#" + let actual = nu!(" for i in 1..2 { nu --testbin fail } - print 3"#); + print 3"); assert!(!actual.out.contains('3')); - let actual = nu!(r#" + let actual = nu!(" let x = [1 2] for i in $x { nu --testbin fail } - print 3"#); + print 3"); assert!(!actual.out.contains('3')); } diff --git a/crates/nu-command/tests/commands/format.rs b/crates/nu-command/tests/commands/format.rs index 63629e203..858e21149 100644 --- a/crates/nu-command/tests/commands/format.rs +++ b/crates/nu-command/tests/commands/format.rs @@ -66,12 +66,12 @@ fn format_filesize_works() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls | format filesize KB size | get size | first - "# + " )); assert_eq!(actual.out, "0.0 KB"); diff --git a/crates/nu-command/tests/commands/get.rs b/crates/nu-command/tests/commands/get.rs index 2011f2a0a..9947ceffb 100644 --- a/crates/nu-command/tests/commands/get.rs +++ b/crates/nu-command/tests/commands/get.rs @@ -189,7 +189,7 @@ fn quoted_column_access() { #[test] fn get_does_not_delve_too_deep_in_nested_lists() { - let actual = nu!(r#"[[{foo: bar}]] | get foo"#); + let actual = nu!("[[{foo: bar}]] | get foo"); assert!(actual.err.contains("cannot find column")); } diff --git a/crates/nu-command/tests/commands/group_by.rs b/crates/nu-command/tests/commands/group_by.rs index dba7afc73..245bcd3b4 100644 --- a/crates/nu-command/tests/commands/group_by.rs +++ b/crates/nu-command/tests/commands/group_by.rs @@ -86,10 +86,10 @@ fn errors_if_column_not_found() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open los_tres_caballeros.csv | group-by ttype - "# + " )); assert!(actual.err.contains("did you mean 'type'"),); diff --git a/crates/nu-command/tests/commands/headers.rs b/crates/nu-command/tests/commands/headers.rs index ed6f26d42..51001f8cd 100644 --- a/crates/nu-command/tests/commands/headers.rs +++ b/crates/nu-command/tests/commands/headers.rs @@ -4,12 +4,12 @@ use nu_test_support::{nu, pipeline}; fn headers_uses_first_row_as_header() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open sample_headers.xlsx | get Sheet1 | headers | get header0 - | to json --raw"# + | to json --raw" )); assert_eq!(actual.out, r#"["r1c0","r2c0"]"#) @@ -19,12 +19,12 @@ fn headers_uses_first_row_as_header() { fn headers_adds_missing_column_name() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open sample_headers.xlsx | get Sheet1 | headers | get column1 - | to json --raw"# + | to json --raw" )); assert_eq!(actual.out, r#"["r1c1","r2c1"]"#) @@ -33,11 +33,11 @@ fn headers_adds_missing_column_name() { #[test] fn headers_handles_missing_values() { let actual = nu!(pipeline( - r#" + " [{x: a, y: b}, {x: 1, y: 2}, {x: 1, z: 3}] | headers | to nuon --raw - "# + " )); assert_eq!(actual.out, "[{a: 1, b: 2}, {a: 1}]") @@ -46,9 +46,9 @@ fn headers_handles_missing_values() { #[test] fn headers_invalid_column_type_empty_record() { let actual = nu!(pipeline( - r#" + " [[a b]; [{}, 2], [3,4] ] - | headers"# + | headers" )); assert!(actual @@ -59,9 +59,9 @@ fn headers_invalid_column_type_empty_record() { #[test] fn headers_invalid_column_type_record() { let actual = nu!(pipeline( - r#" + " [[a b]; [1 (scope aliases)] [2 2]] - | headers"# + | headers" )); assert!(actual @@ -72,9 +72,9 @@ fn headers_invalid_column_type_record() { #[test] fn headers_invalid_column_type_array() { let actual = nu!(pipeline( - r#" + " [[a b]; [[f,g], 2], [3,4] ] - | headers"# + | headers" )); assert!(actual @@ -85,9 +85,9 @@ fn headers_invalid_column_type_array() { #[test] fn headers_invalid_column_type_range() { let actual = nu!(pipeline( - r#" + " [[a b]; [(1..5), 2], [3,4] ] - | headers"# + | headers" )); assert!(actual @@ -98,9 +98,9 @@ fn headers_invalid_column_type_range() { #[test] fn headers_invalid_column_type_duration() { let actual = nu!(pipeline( - r#" + " [[a b]; [((date now) - (date now)), 2], [3,4] ] - | headers"# + | headers" )); assert!(actual diff --git a/crates/nu-command/tests/commands/histogram.rs b/crates/nu-command/tests/commands/histogram.rs index 97d1f8451..738690e11 100644 --- a/crates/nu-command/tests/commands/histogram.rs +++ b/crates/nu-command/tests/commands/histogram.rs @@ -105,13 +105,13 @@ fn help() { #[test] fn count() { let actual = nu!(pipeline( - r#" + " echo [[bit]; [1] [0] [0] [0] [0] [0] [0] [1] [1]] | histogram bit --percentage-type relative | sort-by count | reject frequency | to json - "# + " )); let bit_json = r#"[ { "bit": 1, "count": 3, "quantile": 0.5, "percentage": "50.00%" }, { "bit": 0, "count": 6, "quantile": 1, "percentage": "100.00%" }]"#; @@ -122,13 +122,13 @@ fn count() { #[test] fn count_with_normalize_percentage() { let actual = nu!(pipeline( - r#" + " echo [[bit]; [1] [0] [0] [0] [0] [0] [0] [1]] | histogram bit --percentage-type normalize | sort-by count | reject frequency | to json - "# + " )); let bit_json = r#"[ { "bit": 1, "count": 2, "quantile": 0.25, "percentage": "25.00%" }, { "bit": 0, "count": 6, "quantile": 0.75, "percentage": "75.00%" }]"#; diff --git a/crates/nu-command/tests/commands/insert.rs b/crates/nu-command/tests/commands/insert.rs index d183d5e70..50a881053 100644 --- a/crates/nu-command/tests/commands/insert.rs +++ b/crates/nu-command/tests/commands/insert.rs @@ -16,7 +16,7 @@ fn insert_the_column() { #[test] fn doesnt_convert_record_to_table() { - let actual = nu!(r#"{a:1} | insert b 2 | to nuon"#); + let actual = nu!("{a:1} | insert b 2 | to nuon"); assert_eq!(actual.out, "{a: 1, b: 2}"); } @@ -38,36 +38,28 @@ fn insert_the_column_conflict() { #[test] fn insert_into_list() { - let actual = nu!(r#" - [1, 2, 3] | insert 1 abc | to json -r - "#); + let actual = nu!("[1, 2, 3] | insert 1 abc | to json -r"); assert_eq!(actual.out, r#"[1,"abc",2,3]"#); } #[test] fn insert_into_list_begin() { - let actual = nu!(r#" - [1, 2, 3] | insert 0 abc | to json -r - "#); + let actual = nu!("[1, 2, 3] | insert 0 abc | to json -r"); assert_eq!(actual.out, r#"["abc",1,2,3]"#); } #[test] fn insert_into_list_end() { - let actual = nu!(r#" - [1, 2, 3] | insert 3 abc | to json -r - "#); + let actual = nu!("[1, 2, 3] | insert 3 abc | to json -r"); assert_eq!(actual.out, r#"[1,2,3,"abc"]"#); } #[test] fn insert_past_end_list() { - let actual = nu!(r#" - [1, 2, 3] | insert 5 abc | to json -r - "#); + let actual = nu!("[1, 2, 3] | insert 5 abc | to json -r"); assert_eq!(actual.out, r#"[1,2,3,null,null,"abc"]"#); } @@ -75,7 +67,7 @@ fn insert_past_end_list() { #[test] fn insert_uses_enumerate_index() { let actual = nu!( - r#"[[a]; [7] [6]] | enumerate | insert b {|el| $el.index + 1 + $el.item.a } | flatten | to nuon"# + "[[a]; [7] [6]] | enumerate | insert b {|el| $el.index + 1 + $el.item.a } | flatten | to nuon" ); assert_eq!(actual.out, "[[index, a, b]; [0, 7, 8], [1, 6, 8]]"); diff --git a/crates/nu-command/tests/commands/into_filesize.rs b/crates/nu-command/tests/commands/into_filesize.rs index 7fb6ccd60..ad8a3892c 100644 --- a/crates/nu-command/tests/commands/into_filesize.rs +++ b/crates/nu-command/tests/commands/into_filesize.rs @@ -2,18 +2,14 @@ use nu_test_support::{nu, pipeline}; #[test] fn into_filesize_int() { - let actual = nu!(r#" - 1 | into filesize - "#); + let actual = nu!("1 | into filesize"); assert!(actual.out.contains("1 B")); } #[test] fn into_filesize_decimal() { - let actual = nu!(r#" - 1.2 | into filesize - "#); + let actual = nu!("1.2 | into filesize"); assert!(actual.out.contains("1 B")); } @@ -54,18 +50,14 @@ fn into_filesize_str_many_newlines() { #[test] fn into_filesize_filesize() { - let actual = nu!(r#" - 3kib | into filesize - "#); + let actual = nu!("3kib | into filesize"); assert!(actual.out.contains("3.0 KiB")); } #[test] fn into_filesize_negative_filesize() { - let actual = nu!(r#" - -3kib | into filesize - "#); + let actual = nu!("-3kib | into filesize"); assert!(actual.out.contains("-3.0 KiB")); } diff --git a/crates/nu-command/tests/commands/into_int.rs b/crates/nu-command/tests/commands/into_int.rs index f24cc14e5..40b815431 100644 --- a/crates/nu-command/tests/commands/into_int.rs +++ b/crates/nu-command/tests/commands/into_int.rs @@ -5,36 +5,28 @@ use nu_test_support::nu; #[test] fn into_int_filesize() { - let actual = nu!(r#" - echo 1kb | into int | each { |it| $it / 1000 } - "#); + let actual = nu!("echo 1kb | into int | each { |it| $it / 1000 }"); assert!(actual.out.contains('1')); } #[test] fn into_int_filesize2() { - let actual = nu!(r#" - echo 1kib | into int | each { |it| $it / 1024 } - "#); + let actual = nu!("echo 1kib | into int | each { |it| $it / 1024 }"); assert!(actual.out.contains('1')); } #[test] fn into_int_int() { - let actual = nu!(r#" - echo 1024 | into int | each { |it| $it / 1024 } - "#); + let actual = nu!("echo 1024 | into int | each { |it| $it / 1024 }"); assert!(actual.out.contains('1')); } #[test] fn into_int_binary() { - let actual = nu!(r#" - echo 0x[01010101] | into int - "#); + let actual = nu!("echo 0x[01010101] | into int"); assert!(actual.out.contains("16843009")); } diff --git a/crates/nu-command/tests/commands/lines.rs b/crates/nu-command/tests/commands/lines.rs index e64b7f0b4..ee8dc5881 100644 --- a/crates/nu-command/tests/commands/lines.rs +++ b/crates/nu-command/tests/commands/lines.rs @@ -23,12 +23,12 @@ fn lines() { fn lines_proper_buffering() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open lines_test.txt -r | lines | str length | to json -r - "# + " )); assert_eq!(actual.out, "[8193,3]"); @@ -38,12 +38,12 @@ fn lines_proper_buffering() { fn lines_multi_value_split() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open sample-simple.json | get first second | lines | length - "# + " )); assert_eq!(actual.out, "6"); diff --git a/crates/nu-command/tests/commands/loop_.rs b/crates/nu-command/tests/commands/loop_.rs index 272bc2fe5..1acf2b3c1 100644 --- a/crates/nu-command/tests/commands/loop_.rs +++ b/crates/nu-command/tests/commands/loop_.rs @@ -2,7 +2,7 @@ use nu_test_support::nu; #[test] fn loop_doesnt_auto_print_in_each_iteration() { - let actual = nu!(r#" + let actual = nu!(" mut total = 0; loop { if $total == 3 { @@ -11,7 +11,7 @@ fn loop_doesnt_auto_print_in_each_iteration() { $total += 1; } echo 1 - }"#); + }"); // Make sure we don't see any of these values in the output // As we do not auto-print loops anymore assert!(!actual.out.contains('1')); @@ -19,7 +19,7 @@ fn loop_doesnt_auto_print_in_each_iteration() { #[test] fn loop_break_on_external_failed() { - let actual = nu!(r#" + let actual = nu!(" mut total = 0; loop { if $total == 3 { @@ -29,7 +29,7 @@ fn loop_break_on_external_failed() { } print 1; nu --testbin fail; - }"#); + }"); // Note: nu! macro auto replace "\n" and "\r\n" with "" // so our output will be `1`. assert_eq!(actual.out, "1"); @@ -37,7 +37,7 @@ fn loop_break_on_external_failed() { #[test] fn failed_loop_should_break_running() { - let actual = nu!(r#" + let actual = nu!(" mut total = 0; loop { if $total == 3 { @@ -47,6 +47,6 @@ fn failed_loop_should_break_running() { } nu --testbin fail; } - print 3"#); + print 3"); assert!(!actual.out.contains('3')); } diff --git a/crates/nu-command/tests/commands/ls.rs b/crates/nu-command/tests/commands/ls.rs index 62ee7981a..c1f86023b 100644 --- a/crates/nu-command/tests/commands/ls.rs +++ b/crates/nu-command/tests/commands/ls.rs @@ -13,10 +13,10 @@ fn lists_regular_files() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls | length - "# + " )); assert_eq!(actual.out, "3"); @@ -35,10 +35,10 @@ fn lists_regular_files_using_asterisk_wildcard() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls *.txt | length - "# + " )); assert_eq!(actual.out, "3"); @@ -57,10 +57,10 @@ fn lists_regular_files_using_question_mark_wildcard() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls *.??.txt | length - "# + " )); assert_eq!(actual.out, "3"); @@ -82,11 +82,11 @@ fn lists_all_files_in_directories_from_stream() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " echo dir_a dir_b | each { |it| ls $it } | flatten | length - "# + " )); assert_eq!(actual.out, "4"); @@ -100,10 +100,10 @@ fn does_not_fail_if_glob_matches_empty_directory() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls dir_a | length - "# + " )); assert_eq!(actual.out, "0"); @@ -138,9 +138,9 @@ fn list_files_from_two_parents_up_using_multiple_dots() { let actual = nu!( cwd: dirs.test().join("foo/bar"), - r#" + " ls ... | length - "# + " ); assert_eq!(actual.out, "5"); @@ -160,10 +160,10 @@ fn lists_hidden_file_when_explicitly_specified() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls .testdotfile | length - "# + " )); assert_eq!(actual.out, "1"); @@ -194,10 +194,10 @@ fn lists_all_hidden_files_when_glob_contains_dot() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls **/.* | length - "# + " )); assert_eq!(actual.out, "3"); @@ -231,10 +231,10 @@ fn lists_all_hidden_files_when_glob_does_not_contain_dot() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls **/* | length - "# + " )); assert_eq!(actual.out, "5"); @@ -255,10 +255,10 @@ fn glob_with_hidden_directory() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls **/* | length - "# + " )); assert_eq!(actual.out, ""); @@ -267,10 +267,10 @@ fn glob_with_hidden_directory() { // will list files if provide `-a` flag. let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls -a **/* | length - "# + " )); assert_eq!(actual.out, "4"); @@ -287,16 +287,16 @@ fn fails_with_ls_to_dir_without_permission() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " chmod 000 dir_a; ls dir_a - "# + " )); let check_not_root = nu!( cwd: dirs.test(), pipeline( - r#" + " id -u - "# + " )); assert!( @@ -321,10 +321,10 @@ fn lists_files_including_starting_with_dot() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls -a | length - "# + " )); assert_eq!(actual.out, "5"); @@ -426,12 +426,12 @@ fn lists_with_directory_flag_without_argument() { // Test if there are some files in the current directory let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " cd dir_files; ls --directory | get name | to text - "# + " )); let expected = "."; assert_eq!( @@ -441,12 +441,12 @@ fn lists_with_directory_flag_without_argument() { // Test if there is no file in the current directory let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " cd dir_empty; ls -D | get name | to text - "# + " )); let expected = "."; assert_eq!( @@ -497,7 +497,7 @@ fn can_list_system_folder() { let ls_with_filter = nu!( cwd: "C:\\Windows\\System32", pipeline( - r#"ls | where size > 10mb"# + "ls | where size > 10mb" )); assert_eq!(ls_with_filter.err, ""); } @@ -547,9 +547,9 @@ fn list_ignores_ansi() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls | find .txt | each {|| ls $in.name } - "# + " )); assert!(actual.err.is_empty()); diff --git a/crates/nu-command/tests/commands/match_.rs b/crates/nu-command/tests/commands/match_.rs index ccb404f16..41e0c7916 100644 --- a/crates/nu-command/tests/commands/match_.rs +++ b/crates/nu-command/tests/commands/match_.rs @@ -18,7 +18,7 @@ fn match_for_range_unmatched() { #[test] fn match_for_record() { - let actual = nu!(r#"match {a: 11} { {a: $b} => { print $b }}"#); + let actual = nu!("match {a: 11} { {a: $b} => { print $b }}"); // Make sure we don't see any of these values in the output // As we do not auto-print loops anymore assert_eq!(actual.out, "11"); @@ -26,7 +26,7 @@ fn match_for_record() { #[test] fn match_for_record_shorthand() { - let actual = nu!(r#"match {a: 12} { {$a} => { print $a }}"#); + let actual = nu!("match {a: 12} { {$a} => { print $a }}"); // Make sure we don't see any of these values in the output // As we do not auto-print loops anymore assert_eq!(actual.out, "12"); @@ -164,7 +164,7 @@ fn match_or_pattern_overlap_2() { #[test] fn match_doesnt_overwrite_variable() { - let actual = nu!(r#"let b = 100; match 55 { $b => {} }; print $b"#); + let actual = nu!("let b = 100; match 55 { $b => {} }; print $b"); // Make sure we don't see any of these values in the output // As we do not auto-print loops anymore assert_eq!(actual.out, "100"); diff --git a/crates/nu-command/tests/commands/merge.rs b/crates/nu-command/tests/commands/merge.rs index 2422ab1b0..24947be97 100644 --- a/crates/nu-command/tests/commands/merge.rs +++ b/crates/nu-command/tests/commands/merge.rs @@ -44,9 +44,9 @@ fn row() { #[test] fn single_record_no_overwrite() { assert_eq!( - nu!(r#" + nu!(" {a: 1, b: 5} | merge {c: 2} | to nuon - "#) + ") .out, "{a: 1, b: 5, c: 2}" ); @@ -55,9 +55,9 @@ fn single_record_no_overwrite() { #[test] fn single_record_overwrite() { assert_eq!( - nu!(r#" + nu!(" {a: 1, b: 2} | merge {a: 2} | to nuon - "#) + ") .out, "{a: 2, b: 2}" ); @@ -66,9 +66,9 @@ fn single_record_overwrite() { #[test] fn single_row_table_overwrite() { assert_eq!( - nu!(r#" + nu!(" [[a b]; [1 4]] | merge [[a b]; [2 4]] | to nuon - "#) + ") .out, "[[a, b]; [2, 4]]" ); @@ -77,9 +77,9 @@ fn single_row_table_overwrite() { #[test] fn single_row_table_no_overwrite() { assert_eq!( - nu!(r#" + nu!(" [[a b]; [1 4]] | merge [[c d]; [2 4]] | to nuon - "#) + ") .out, "[[a, b, c, d]; [1, 4, 2, 4]]" ); @@ -88,9 +88,9 @@ fn single_row_table_no_overwrite() { #[test] fn multi_row_table_no_overwrite() { assert_eq!( - nu!(r#" + nu!(" [[a b]; [1 4] [8 9] [9 9]] | merge [[c d]; [2 4]] | to nuon - "#) + ") .out, "[{a: 1, b: 4, c: 2, d: 4}, {a: 8, b: 9}, {a: 9, b: 9}]" ); @@ -99,9 +99,9 @@ fn multi_row_table_no_overwrite() { #[test] fn multi_row_table_overwrite() { assert_eq!( - nu!(r#" + nu!(" [[a b]; [1 4] [8 9] [9 9]] | merge [[a b]; [7 7]] | to nuon - "#) + ") .out, "[[a, b]; [7, 7], [8, 9], [9, 9]]" ); diff --git a/crates/nu-command/tests/commands/mkdir.rs b/crates/nu-command/tests/commands/mkdir.rs index 7943ce776..7851fc006 100644 --- a/crates/nu-command/tests/commands/mkdir.rs +++ b/crates/nu-command/tests/commands/mkdir.rs @@ -68,9 +68,7 @@ fn print_created_paths() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" - mkdir -v dir_1 dir_2 dir_3 - "# + "mkdir -v dir_1 dir_2 dir_3" )); assert!(files_exist_at( diff --git a/crates/nu-command/tests/commands/mut_.rs b/crates/nu-command/tests/commands/mut_.rs index c56beebc2..71b57c357 100644 --- a/crates/nu-command/tests/commands/mut_.rs +++ b/crates/nu-command/tests/commands/mut_.rs @@ -2,18 +2,14 @@ use nu_test_support::nu; #[test] fn mut_variable() { - let actual = nu!(r#" - mut x = 3; $x = $x + 1; $x - "#); + let actual = nu!("mut x = 3; $x = $x + 1; $x"); assert_eq!(actual.out, "4"); } #[test] fn mut_name_builtin_var() { - let actual = nu!(r#" - mut in = 3 - "#); + let actual = nu!("mut in = 3"); assert!(actual .err @@ -22,9 +18,7 @@ fn mut_name_builtin_var() { #[test] fn mut_name_builtin_var_with_dollar() { - let actual = nu!(r#" - mut $env = 3 - "#); + let actual = nu!("mut $env = 3"); assert!(actual .err @@ -33,99 +27,77 @@ fn mut_name_builtin_var_with_dollar() { #[test] fn mut_variable_in_loop() { - let actual = nu!(r#" - mut x = 1; for i in 1..10 { $x = $x + $i}; $x - "#); + let actual = nu!("mut x = 1; for i in 1..10 { $x = $x + $i}; $x"); assert_eq!(actual.out, "56"); } #[test] fn capture_of_mutable_var() { - let actual = nu!(r#" - mut x = 123; {|| $x } - "#); + let actual = nu!("mut x = 123; {|| $x }"); assert!(actual.err.contains("capture of mutable variable")); } #[test] fn mut_add_assign() { - let actual = nu!(r#" - mut y = 3; $y += 2; $y - "#); + let actual = nu!("mut y = 3; $y += 2; $y"); assert_eq!(actual.out, "5"); } #[test] fn mut_minus_assign() { - let actual = nu!(r#" - mut y = 3; $y -= 2; $y - "#); + let actual = nu!("mut y = 3; $y -= 2; $y"); assert_eq!(actual.out, "1"); } #[test] fn mut_multiply_assign() { - let actual = nu!(r#" - mut y = 3; $y *= 2; $y - "#); + let actual = nu!("mut y = 3; $y *= 2; $y"); assert_eq!(actual.out, "6"); } #[test] fn mut_divide_assign() { - let actual = nu!(r#" - mut y = 8; $y /= 2; $y - "#); + let actual = nu!("mut y = 8; $y /= 2; $y"); assert_eq!(actual.out, "4"); } #[test] fn mut_path_insert() { - let actual = nu!(r#" - mut y = {abc: 123}; $y.abc = 456; $y.abc - "#); + let actual = nu!("mut y = {abc: 123}; $y.abc = 456; $y.abc"); assert_eq!(actual.out, "456"); } #[test] fn mut_path_insert_list() { - let actual = nu!(r#" - mut a = [0 1 2]; $a.3 = 3; $a | to nuon - "#); + let actual = nu!("mut a = [0 1 2]; $a.3 = 3; $a | to nuon"); assert_eq!(actual.out, "[0, 1, 2, 3]"); } #[test] fn mut_path_upsert() { - let actual = nu!(r#" - mut a = {b:[{c:1}]}; $a.b.0.d = 11; $a.b.0.d - "#); + let actual = nu!("mut a = {b:[{c:1}]}; $a.b.0.d = 11; $a.b.0.d"); assert_eq!(actual.out, "11"); } #[test] fn mut_path_upsert_list() { - let actual = nu!(r#" - mut a = [[[3] 2] 1]; $a.0.0.1 = 0; $a.0.2 = 0; $a.2 = 0; $a | to nuon - "#); + let actual = nu!("mut a = [[[3] 2] 1]; $a.0.0.1 = 0; $a.0.2 = 0; $a.2 = 0; $a | to nuon"); assert_eq!(actual.out, "[[[3, 0], 2, 0], 1, 0]"); } #[test] fn mut_path_operator_assign() { - let actual = nu!(r#" - mut a = {b:1}; $a.b += 3; $a.b -= 2; $a.b *= 10; $a.b /= 4; $a.b - "#); + let actual = nu!("mut a = {b:1}; $a.b += 3; $a.b -= 2; $a.b *= 10; $a.b /= 4; $a.b"); assert_eq!(actual.out, "5"); } diff --git a/crates/nu-command/tests/commands/nu_check.rs b/crates/nu-command/tests/commands/nu_check.rs index b9c97a1d6..9f34635c7 100644 --- a/crates/nu-command/tests/commands/nu_check.rs +++ b/crates/nu-command/tests/commands/nu_check.rs @@ -18,9 +18,9 @@ fn parse_script_success() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " nu-check script.nu - "# + " )); assert!(actual.err.is_empty()); @@ -43,9 +43,9 @@ fn parse_script_with_wrong_type() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " nu-check -d --as-module script.nu - "# + " )); assert!(actual.err.contains("Failed to parse content")); @@ -67,9 +67,9 @@ fn parse_script_failure() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " nu-check -d script.nu - "# + " )); assert!(actual.err.contains("Unexpected end of code")); @@ -96,9 +96,9 @@ fn parse_module_success() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " nu-check --as-module foo.nu - "# + " )); assert!(actual.err.is_empty()); @@ -125,9 +125,9 @@ fn parse_module_with_wrong_type() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " nu-check -d foo.nu - "# + " )); assert!(actual.err.contains("Failed to parse content")); @@ -153,9 +153,9 @@ fn parse_module_failure() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " nu-check -d --as-module foo.nu - "# + " )); assert!(actual.err.contains("Unexpected end of code")); @@ -167,9 +167,9 @@ fn file_not_exist() { Playground::setup("nu_check_test_7", |dirs, _sandbox| { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " nu-check --as-module foo.nu - "# + " )); assert!(actual.err.contains("file not found")); @@ -196,9 +196,9 @@ fn parse_unsupported_file() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " nu-check --as-module foo.txt - "# + " )); assert!(actual @@ -211,9 +211,9 @@ fn parse_dir_failure() { Playground::setup("nu_check_test_9", |dirs, _sandbox| { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " nu-check --as-module ~ - "# + " )); assert!(actual @@ -236,9 +236,9 @@ fn parse_module_success_2() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " nu-check --as-module foo.nu - "# + " )); assert!(actual.err.is_empty()); @@ -261,9 +261,9 @@ fn parse_script_success_with_raw_stream() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open script.nu | nu-check - "# + " )); assert!(actual.err.is_empty()); @@ -290,9 +290,9 @@ fn parse_module_success_with_raw_stream() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open foo.nu | nu-check --as-module - "# + " )); assert!(actual.err.is_empty()); @@ -348,9 +348,9 @@ fn parse_module_success_with_internal_stream() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open foo.nu | lines | nu-check --as-module - "# + " )); assert!(actual.err.is_empty()); @@ -397,9 +397,9 @@ fn parse_script_success_with_complex_internal_stream() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open grep.nu | lines | nu-check - "# + " )); assert!(actual.err.is_empty()); @@ -446,9 +446,9 @@ fn parse_script_failure_with_complex_internal_stream() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open grep.nu | lines | nu-check - "# + " )); assert_eq!(actual.out, "false".to_string()); @@ -495,9 +495,9 @@ fn parse_script_success_with_complex_external_stream() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open grep.nu | nu-check - "# + " )); assert!(actual.err.is_empty()); @@ -544,9 +544,9 @@ fn parse_module_success_with_complex_external_stream() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open grep.nu | nu-check -d --as-module - "# + " )); assert!(actual.err.is_empty()); @@ -593,9 +593,9 @@ fn parse_with_flag_all_success_for_complex_external_stream() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open grep.nu | nu-check -ad - "# + " )); assert!(actual.err.is_empty()); @@ -642,9 +642,9 @@ fn parse_with_flag_all_failure_for_complex_external_stream() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open grep.nu | nu-check -ad - "# + " )); assert!(actual.err.contains("syntax error")); @@ -691,9 +691,9 @@ fn parse_with_flag_all_failure_for_complex_list_stream() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open grep.nu | lines | nu-check -ad - "# + " )); assert!(actual.err.contains("syntax error")); @@ -716,9 +716,9 @@ fn parse_failure_due_conflicted_flags() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " nu-check -a --as-module script.nu - "# + " )); assert!(actual @@ -755,9 +755,9 @@ fn parse_script_with_nested_scripts_success() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " nu-check lol/lol.nu - "# + " )); assert_eq!(actual.out, "true"); @@ -784,10 +784,10 @@ fn nu_check_respects_file_pwd() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " source-env lol/lol.nu; $env.RETURN - "# + " )); assert_eq!(actual.out, "true"); diff --git a/crates/nu-command/tests/commands/open.rs b/crates/nu-command/tests/commands/open.rs index 1ed940d3f..1e4173132 100644 --- a/crates/nu-command/tests/commands/open.rs +++ b/crates/nu-command/tests/commands/open.rs @@ -113,11 +113,11 @@ fn parses_more_bson_complexity() { fn parses_sqlite() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open sample.db | columns | length - "# + " )); assert_eq!(actual.out, "3"); @@ -128,11 +128,11 @@ fn parses_sqlite() { fn parses_sqlite_get_column_name() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open sample.db | get strings | get x.0 - "# + " )); assert_eq!(actual.out, "hello"); @@ -152,11 +152,11 @@ fn parses_toml() { fn parses_tsv() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open caco3_plastics.tsv | first | get origin - "# + " )); assert_eq!(actual.out, "SPAIN") @@ -166,10 +166,10 @@ fn parses_tsv() { fn parses_json() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open sgml_description.json | get glossary.GlossDiv.GlossList.GlossEntry.GlossSee - "# + " )); assert_eq!(actual.out, "markup") @@ -179,7 +179,7 @@ fn parses_json() { fn parses_xml() { let actual = nu!( cwd: "tests/fixtures/formats", - pipeline(r#" + pipeline(" open jt.xml | get content | where tag == channel @@ -190,7 +190,7 @@ fn parses_xml() { | flatten | where tag == guid | get content.0.content.0 - "#) + ") ); assert_eq!(actual.out, "https://www.jntrnr.com/off-to-new-adventures/") @@ -201,12 +201,12 @@ fn parses_xml() { fn parses_arrow_ipc() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " dfr open caco3_plastics.arrow | dfr into-nu | first | get origin - "# + " )); assert_eq!(actual.out, "SPAIN") @@ -236,9 +236,9 @@ fn errors_if_file_not_found() { fn open_wildcard() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open *.nu | where $it =~ echo | length - "# + " )); assert_eq!(actual.out, "3") @@ -248,9 +248,9 @@ fn open_wildcard() { fn open_multiple_files() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open caco3_plastics.csv caco3_plastics.tsv | get tariff_item | math sum - "# + " )); assert_eq!(actual.out, "58309279992") @@ -280,9 +280,9 @@ fn open_ignore_ansi() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls | find nu.zion | get 0 | get name | open $in - "# + " )); assert!(actual.err.is_empty()); @@ -291,9 +291,7 @@ fn open_ignore_ansi() { #[test] fn open_no_parameter() { - let actual = nu!(r#" - open - "#); + let actual = nu!("open"); assert!(actual.err.contains("needs filename")); } diff --git a/crates/nu-command/tests/commands/par_each.rs b/crates/nu-command/tests/commands/par_each.rs index 4f22fa9e5..6c410100b 100644 --- a/crates/nu-command/tests/commands/par_each.rs +++ b/crates/nu-command/tests/commands/par_each.rs @@ -3,7 +3,7 @@ use nu_test_support::nu; #[test] fn par_each_does_not_flatten_nested_structures() { // This is a regression test for issue #8497 - let actual = nu!(r#"[1 2 3] | par-each { |it| [$it, $it] } | sort | to json --raw"#); + let actual = nu!("[1 2 3] | par-each { |it| [$it, $it] } | sort | to json --raw"); assert_eq!(actual.out, "[[1,1],[2,2],[3,3]]"); } diff --git a/crates/nu-command/tests/commands/range.rs b/crates/nu-command/tests/commands/range.rs index 0941f3dc1..3080e0af0 100644 --- a/crates/nu-command/tests/commands/range.rs +++ b/crates/nu-command/tests/commands/range.rs @@ -9,12 +9,12 @@ fn selects_a_row() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls | sort-by name | range 0..0 | get name.0 - "# + " )); assert_eq!(actual.out, "notes.txt"); @@ -32,12 +32,12 @@ fn selects_some_rows() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls | get name | range 1..2 | length - "# + " )); assert_eq!(actual.out, "2"); @@ -55,12 +55,12 @@ fn negative_indices() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls | get name | range (-1..) | length - "# + " )); assert_eq!(actual.out, "1"); diff --git a/crates/nu-command/tests/commands/redirection.rs b/crates/nu-command/tests/commands/redirection.rs index 42e9164bb..1104262b1 100644 --- a/crates/nu-command/tests/commands/redirection.rs +++ b/crates/nu-command/tests/commands/redirection.rs @@ -104,7 +104,7 @@ fn separate_redirection() { sandbox.with_files(vec![FileWithContent("test.sh", script_body)]); nu!( cwd: dirs.test(), - r#"bash test.sh out> out.txt err> err.txt"# + "bash test.sh out> out.txt err> err.txt" ); } #[cfg(windows)] @@ -112,7 +112,7 @@ fn separate_redirection() { sandbox.with_files(vec![FileWithContent("test.bat", script_body)]); nu!( cwd: dirs.test(), - r#"cmd /D /c test.bat out> out.txt err> err.txt"# + "cmd /D /c test.bat out> out.txt err> err.txt" ); } // check for stdout redirection file. @@ -142,10 +142,10 @@ fn same_target_redirection_with_too_much_stderr_not_hang_nushell() { nu!( cwd: dirs.test(), pipeline( - r#" + " $env.LARGE = (open --raw a_large_file.txt); nu --testbin echo_env_stderr LARGE out+err> another_large_file.txt - "# + " ), ); @@ -166,7 +166,7 @@ fn redirection_keep_exit_codes() { sandbox.with_files(vec![FileWithContent("test.sh", script_body)]); nu!( cwd: dirs.test(), - r#"bash test.sh out> out.txt err> err.txt; echo $env.LAST_EXIT_CODE"# + "bash test.sh out> out.txt err> err.txt; echo $env.LAST_EXIT_CODE" ) }; #[cfg(windows)] @@ -174,7 +174,7 @@ fn redirection_keep_exit_codes() { sandbox.with_files(vec![FileWithContent("test.bat", script_body)]); nu!( cwd: dirs.test(), - r#"cmd /D /c test.bat out> out.txt err> err.txt; echo $env.LAST_EXIT_CODE"# + "cmd /D /c test.bat out> out.txt err> err.txt; echo $env.LAST_EXIT_CODE" ) }; assert_eq!(output.out, "10") @@ -196,7 +196,7 @@ fn redirection_with_pipeline_works() { nu!( cwd: dirs.test(), - r#"bash test.sh out> out.txt | describe"# + "bash test.sh out> out.txt | describe" ); // check for stdout redirection file. let expected_out_file = dirs.test().join("out.txt"); diff --git a/crates/nu-command/tests/commands/reduce.rs b/crates/nu-command/tests/commands/reduce.rs index e722f3728..af8078a98 100644 --- a/crates/nu-command/tests/commands/reduce.rs +++ b/crates/nu-command/tests/commands/reduce.rs @@ -18,11 +18,11 @@ fn reduce_table_column() { #[test] fn reduce_table_column_with_path() { let actual = nu!(pipeline( - r#" + " [{month:2,total:30}, {month:3,total:10}, {month:4,total:3}, {month:5,total:60}] | reduce -f 20 { |it, acc| $it.total + $acc ** 1.05} | into string -d 1 - "# + " )); assert_eq!(actual.out, "180.6"); @@ -31,10 +31,10 @@ fn reduce_table_column_with_path() { #[test] fn reduce_rows_example() { let actual = nu!(pipeline( - r#" + " [[a,b]; [1,2] [3,4]] | reduce -f 1.6 { |it, acc| $acc * ($it.a | into int) + ($it.b | into int) } - "# + " )); assert_eq!(actual.out, "14.8"); @@ -43,14 +43,14 @@ fn reduce_rows_example() { #[test] fn reduce_with_return_in_closure() { let actual = nu!(pipeline( - r#" + " [1, 2] | reduce --fold null { |it, state| if $it == 1 { return 10 }; return ($it * $state) } - "# + " )); assert_eq!(actual.out, "20"); @@ -60,11 +60,11 @@ fn reduce_with_return_in_closure() { #[test] fn reduce_enumerate_example() { let actual = nu!(pipeline( - r#" + " echo one longest three bar | enumerate | reduce { |it, acc| if ($it.item | str length) > ($acc.item | str length) {echo $it} else {echo $acc}} | get index - "# + " )); assert_eq!(actual.out, "1"); @@ -73,12 +73,12 @@ fn reduce_enumerate_example() { #[test] fn reduce_enumerate_integer_addition_example() { let actual = nu!(pipeline( - r#" + " echo [1 2 3 4] | enumerate | reduce { |it, acc| { index: ($it.index) item: ($acc.item + $it.item)} } | get item - "# + " )); assert_eq!(actual.out, "10"); @@ -87,7 +87,7 @@ fn reduce_enumerate_integer_addition_example() { #[test] fn folding_with_tables() { let actual = nu!(pipeline( - r#" + " echo [10 20 30 40] | reduce -f [] { |it, acc| with-env [value $it] { @@ -95,7 +95,7 @@ fn folding_with_tables() { } } | math sum - "# + " )); assert_eq!(actual.out, "1000"); @@ -104,9 +104,7 @@ fn folding_with_tables() { #[test] fn error_reduce_fold_type_mismatch() { let actual = nu!(pipeline( - r#" - echo a b c | reduce -f 0 { |it, acc| $acc + $it } - "# + "echo a b c | reduce -f 0 { |it, acc| $acc + $it }" )); assert!(actual.err.contains("mismatch")); @@ -114,11 +112,7 @@ fn error_reduce_fold_type_mismatch() { #[test] fn error_reduce_empty() { - let actual = nu!(pipeline( - r#" - reduce { |it, acc| $acc + $it } - "# - )); + let actual = nu!(pipeline("reduce { |it, acc| $acc + $it }")); assert!(actual.err.contains("needs input")); } @@ -126,9 +120,7 @@ fn error_reduce_empty() { #[test] fn enumerate_reduce_example() { let actual = nu!(pipeline( - r#" - [one longest three bar] | enumerate | reduce {|it, acc| if ($it.item | str length) > ($acc.item | str length) { $it } else { $acc }} | get index - "# + "[one longest three bar] | enumerate | reduce {|it, acc| if ($it.item | str length) > ($acc.item | str length) { $it } else { $acc }} | get index" )); assert_eq!(actual.out, "1"); diff --git a/crates/nu-command/tests/commands/rename.rs b/crates/nu-command/tests/commands/rename.rs index 50fc14945..836377ba8 100644 --- a/crates/nu-command/tests/commands/rename.rs +++ b/crates/nu-command/tests/commands/rename.rs @@ -17,14 +17,14 @@ fn changes_the_column_name() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open los_cuatro_mosqueteros.txt | lines | wrap name | rename mosqueteros | get mosqueteros | length - "# + " )); assert_eq!(actual.out, "4"); @@ -76,11 +76,11 @@ fn errors_if_no_columns_present() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open los_cuatro_mosqueteros.txt | lines | rename mosqueteros - "# + " )); assert!(actual.err.contains("command doesn't support")); diff --git a/crates/nu-command/tests/commands/return_.rs b/crates/nu-command/tests/commands/return_.rs index 9f5bc0094..e5944dc5c 100644 --- a/crates/nu-command/tests/commands/return_.rs +++ b/crates/nu-command/tests/commands/return_.rs @@ -2,18 +2,14 @@ use nu_test_support::{nu, pipeline}; #[test] fn early_return_if_true() { - let actual = nu!(r#" - def foo [x] { if true { return 2 }; $x }; foo 100 - "#); + let actual = nu!("def foo [x] { if true { return 2 }; $x }; foo 100"); assert_eq!(actual.out, r#"2"#); } #[test] fn early_return_if_false() { - let actual = nu!(r#" - def foo [x] { if false { return 2 }; $x }; foo 100 - "#); + let actual = nu!("def foo [x] { if false { return 2 }; $x }; foo 100"); assert_eq!(actual.out, r#"100"#); } @@ -22,9 +18,7 @@ fn early_return_if_false() { fn return_works_in_script_without_def_main() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" - nu early_return.nu - "# + "nu early_return.nu" )); assert!(actual.err.is_empty()); diff --git a/crates/nu-command/tests/commands/rm.rs b/crates/nu-command/tests/commands/rm.rs index ac7956142..da6937b5c 100644 --- a/crates/nu-command/tests/commands/rm.rs +++ b/crates/nu-command/tests/commands/rm.rs @@ -313,7 +313,7 @@ fn rm_wildcard_leading_dot_deletes_dotfiles() { nu!( cwd: dirs.test(), - r#"rm .*"# + "rm .*" ); assert!(files_exist_at(vec!["foo"], dirs.test())); diff --git a/crates/nu-command/tests/commands/roll.rs b/crates/nu-command/tests/commands/roll.rs index 481630c18..50d6ee2f4 100644 --- a/crates/nu-command/tests/commands/roll.rs +++ b/crates/nu-command/tests/commands/roll.rs @@ -23,11 +23,11 @@ mod rows { "{} | {}", table(), pipeline( - r#" - roll down - | first - | get status - "# + " + roll down + | first + | get status + " ) )); @@ -40,11 +40,11 @@ mod rows { "{} | {}", table(), pipeline( - r#" - roll up --by 3 - | first - | get status - "# + " + roll up --by 3 + | first + | get status + " ) )); diff --git a/crates/nu-command/tests/commands/run_external.rs b/crates/nu-command/tests/commands/run_external.rs index 29e1efb92..bd4f7e7df 100644 --- a/crates/nu-command/tests/commands/run_external.rs +++ b/crates/nu-command/tests/commands/run_external.rs @@ -7,9 +7,9 @@ use nu_test_support::{nu, pipeline}; fn better_empty_redirection() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " ls | each { |it| nu --testbin cococo $it.name } | ignore - "# + " )); eprintln!("out: {}", actual.out); @@ -50,9 +50,9 @@ fn bare_word_expand_path_glob() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ^ls *.txt - "# + " )); assert!(actual.out.contains("D&D_volume_1.txt")); @@ -130,9 +130,9 @@ fn failed_command_with_semicolon_will_not_execute_following_cmds() { Playground::setup("external failed command with semicolon", |dirs, _| { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ^ls *.abc; echo done - "# + " )); assert!(!actual.out.contains("done")); @@ -228,7 +228,7 @@ fn external_command_expand_tilde_with_back_quotes() { fn external_command_receives_raw_binary_data() { Playground::setup("external command receives raw binary data", |dirs, _| { let actual = - nu!(cwd: dirs.test(), pipeline(r#"0x[deadbeef] | nu --testbin input_bytes_length"#)); + nu!(cwd: dirs.test(), pipeline("0x[deadbeef] | nu --testbin input_bytes_length")); assert_eq!(actual.out, r#"4"#); }) } @@ -239,9 +239,9 @@ fn failed_command_with_semicolon_will_not_execute_following_cmds_windows() { Playground::setup("external failed command with semicolon", |dirs, _| { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ^cargo asdf; echo done - "# + " )); assert!(!actual.out.contains("done")); diff --git a/crates/nu-command/tests/commands/save.rs b/crates/nu-command/tests/commands/save.rs index 3518e2038..a540f6753 100644 --- a/crates/nu-command/tests/commands/save.rs +++ b/crates/nu-command/tests/commands/save.rs @@ -30,7 +30,7 @@ fn writes_out_list() { nu!( cwd: dirs.root(), - r#"[a b c d] | save save_test_3/list_sample.txt"#, + "[a b c d] | save save_test_3/list_sample.txt", ); let actual = file_contents(expected_file); @@ -185,7 +185,7 @@ fn save_failure_not_overrides() { nu!( cwd: dirs.root(), // Writing number to file as toml fails - r#"3 | save save_test_10/result.toml -f"# + "3 | save save_test_10/result.toml -f" ); let actual = file_contents(expected_file); assert_eq!(actual, "Old content"); @@ -272,7 +272,7 @@ fn save_list_stream() { nu!( cwd: dirs.root(), - r#"[a b c d] | each {|i| $i} | save -r save_test_13/list_sample.txt"#, + "[a b c d] | each {|i| $i} | save -r save_test_13/list_sample.txt", ); let actual = file_contents(expected_file); @@ -289,7 +289,7 @@ fn writes_out_range() { nu!( cwd: dirs.root(), - r#"1..3 | save save_test_14/list_sample.json"#, + "1..3 | save save_test_14/list_sample.json", ); let actual = file_contents(expected_file); diff --git a/crates/nu-command/tests/commands/select.rs b/crates/nu-command/tests/commands/select.rs index 85954face..f761628f8 100644 --- a/crates/nu-command/tests/commands/select.rs +++ b/crates/nu-command/tests/commands/select.rs @@ -129,12 +129,12 @@ fn selects_a_row() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls | sort-by name | select 0 | get name.0 - "# + " )); assert_eq!(actual.out, "arepas.txt"); @@ -148,12 +148,12 @@ fn selects_many_rows() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls | get name | select 1 0 | length - "# + " )); assert_eq!(actual.out, "2"); diff --git a/crates/nu-command/tests/commands/sort.rs b/crates/nu-command/tests/commands/sort.rs index 60177435f..3deeba30d 100644 --- a/crates/nu-command/tests/commands/sort.rs +++ b/crates/nu-command/tests/commands/sort.rs @@ -20,14 +20,14 @@ fn by_invalid_types() { fn sort_primitive_values() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open cargo_sample.toml --raw | lines | skip 1 | first 6 | sort | first - "# + " )); assert_eq!(actual.out, "authors = [\"The Nushell Project Developers\"]"); diff --git a/crates/nu-command/tests/commands/sort_by.rs b/crates/nu-command/tests/commands/sort_by.rs index d1c48dd7b..1adeed1f4 100644 --- a/crates/nu-command/tests/commands/sort_by.rs +++ b/crates/nu-command/tests/commands/sort_by.rs @@ -54,12 +54,12 @@ fn sort_by_empty() { fn ls_sort_by_name_sensitive() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open sample-ls-output.json | sort-by name | select name | to json --raw - "# + " )); let json_output = r#"[{"name": "B.txt"},{"name": "C"},{"name": "a.txt"}]"#; @@ -71,12 +71,12 @@ fn ls_sort_by_name_sensitive() { fn ls_sort_by_name_insensitive() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open sample-ls-output.json | sort-by -i name | select name | to json --raw - "# + " )); let json_output = r#"[{"name": "a.txt"},{"name": "B.txt"},{"name": "C"}]"#; @@ -87,12 +87,12 @@ fn ls_sort_by_name_insensitive() { fn ls_sort_by_type_name_sensitive() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open sample-ls-output.json | sort-by type name | select name type | to json --raw - "# + " )); let json_output = r#"[{"name": "C","type": "Dir"},{"name": "B.txt","type": "File"},{"name": "a.txt","type": "File"}]"#; @@ -103,12 +103,12 @@ fn ls_sort_by_type_name_sensitive() { fn ls_sort_by_type_name_insensitive() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open sample-ls-output.json | sort-by -i type name | select name type | to json --raw - "# + " )); let json_output = r#"[{"name": "C","type": "Dir"},{"name": "a.txt","type": "File"},{"name": "B.txt","type": "File"}]"#; diff --git a/crates/nu-command/tests/commands/source_env.rs b/crates/nu-command/tests/commands/source_env.rs index 439c82157..94ca37d4d 100644 --- a/crates/nu-command/tests/commands/source_env.rs +++ b/crates/nu-command/tests/commands/source_env.rs @@ -37,11 +37,11 @@ fn sources_also_files_under_custom_lib_dirs_path() { let actual = nu!( cwd: ".", pipeline( - r#" + " source-env my_library.nu ; hello - "# + " )); assert_eq!(actual.out, "hello nu"); @@ -319,9 +319,9 @@ fn source_env_const_file() { fn source_respects_early_return() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " source early_return.nu - "# + " )); assert!(actual.err.is_empty()); diff --git a/crates/nu-command/tests/commands/split_by.rs b/crates/nu-command/tests/commands/split_by.rs index d52c65373..cafcf22da 100644 --- a/crates/nu-command/tests/commands/split_by.rs +++ b/crates/nu-command/tests/commands/split_by.rs @@ -42,11 +42,11 @@ fn errors_if_no_table_given_as_input() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " ls | get name | split-by type - "# + " )); assert!(actual.err.contains("requires a table")); diff --git a/crates/nu-command/tests/commands/table.rs b/crates/nu-command/tests/commands/table.rs index 006ba18b6..aec59a5fb 100644 --- a/crates/nu-command/tests/commands/table.rs +++ b/crates/nu-command/tests/commands/table.rs @@ -4,7 +4,7 @@ use nu_test_support::{nu, nu_repl_code, pipeline}; #[test] fn table_0() { - let actual = nu!(r#"[[a b, c]; [1 2 3] [4 5 [1 2 3]]] | table"#); + let actual = nu!("[[a b, c]; [1 2 3] [4 5 [1 2 3]]] | table"); assert_eq!( actual.out, "╭───┬───┬───┬────────────────╮\ @@ -18,7 +18,7 @@ fn table_0() { #[test] fn table_collapse_0() { - let actual = nu!(r#"[[a b, c]; [1 2 3] [4 5 [1 2 3]]] | table --collapse"#); + let actual = nu!("[[a b, c]; [1 2 3] [4 5 [1 2 3]]] | table --collapse"); assert_eq!( actual.out, "╭───┬───┬───╮\ @@ -234,7 +234,7 @@ fn table_collapse_hearts() { #[test] fn table_collapse_does_wrapping_for_long_strings() { let actual = nu!( - r#"[[a]; [11111111111111111111111111111111111111111111111111111111111111111111111111111111]] | table --collapse"# + "[[a]; [11111111111111111111111111111111111111111111111111111111111111111111111111111111]] | table --collapse" ); assert_eq!( actual.out, @@ -250,7 +250,7 @@ fn table_collapse_does_wrapping_for_long_strings() { #[test] fn table_expand_0() { - let actual = nu!(r#"[[a b, c]; [1 2 3] [4 5 [1 2 3]]] | table --expand"#); + let actual = nu!("[[a b, c]; [1 2 3] [4 5 [1 2 3]]] | table --expand"); assert_eq!( actual.out, "╭───┬───┬───┬───────────╮\ @@ -271,7 +271,7 @@ fn table_expand_0() { fn table_expand_exceed_overlap_0() { // no expand - let actual = nu!(r#"[[a b, c]; [xxxxxxxxxxxxxxxxxxxxxx 2 3] [4 5 [1 2 3]]] | table --expand"#); + let actual = nu!("[[a b, c]; [xxxxxxxxxxxxxxxxxxxxxx 2 3] [4 5 [1 2 3]]] | table --expand"); assert_eq!( actual.out, @@ -290,7 +290,7 @@ fn table_expand_exceed_overlap_0() { // expand let actual = nu!( - r#"[[a b, c]; [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2 3] [4 5 [1 2 3]]] | table --expand"# + "[[a b, c]; [xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 2 3] [4 5 [1 2 3]]] | table --expand" ); assert_eq!( @@ -310,7 +310,7 @@ fn table_expand_exceed_overlap_0() { #[test] fn table_expand_deep_0() { - let actual = nu!(r#"[[a b, c]; [1 2 3] [4 5 [1 2 [1 2 3]]]] | table --expand --expand-deep=1"#); + let actual = nu!("[[a b, c]; [1 2 3] [4 5 [1 2 [1 2 3]]]] | table --expand --expand-deep=1"); assert_eq!( actual.out, "╭───┬───┬───┬────────────────────────╮\ @@ -328,7 +328,7 @@ fn table_expand_deep_0() { #[test] fn table_expand_deep_1() { - let actual = nu!(r#"[[a b, c]; [1 2 3] [4 5 [1 2 [1 2 3]]]] | table --expand --expand-deep=0"#); + let actual = nu!("[[a b, c]; [1 2 3] [4 5 [1 2 [1 2 3]]]] | table --expand --expand-deep=0"); assert_eq!( actual.out, "╭───┬───┬───┬────────────────╮\ @@ -342,7 +342,7 @@ fn table_expand_deep_1() { #[test] fn table_expand_flatten_0() { - let actual = nu!(r#"[[a b, c]; [1 2 3] [4 5 [1 2 [1 1 1]]]] | table --expand --flatten "#); + let actual = nu!("[[a b, c]; [1 2 3] [4 5 [1 2 [1 1 1]]]] | table --expand --flatten "); assert_eq!( actual.out, "╭───┬───┬───┬───────────────╮\ @@ -361,7 +361,7 @@ fn table_expand_flatten_0() { #[test] fn table_expand_flatten_1() { let actual = nu!( - r#"[[a b, c]; [1 2 3] [4 5 [1 2 [1 1 1]]]] | table --expand --flatten --flatten-separator=,"# + "[[a b, c]; [1 2 3] [4 5 [1 2 [1 1 1]]]] | table --expand --flatten --flatten-separator=," ); assert_eq!( actual.out, @@ -381,7 +381,7 @@ fn table_expand_flatten_1() { #[test] fn table_expand_flatten_and_deep_1() { let actual = nu!( - r#"[[a b, c]; [1 2 3] [4 5 [1 2 [1 [1 1 1] 1]]]] | table --expand --expand-deep=2 --flatten --flatten-separator=,"# + "[[a b, c]; [1 2 3] [4 5 [1 2 [1 [1 1 1] 1]]]] | table --expand --expand-deep=2 --flatten --flatten-separator=," ); assert_eq!( @@ -405,7 +405,7 @@ fn table_expand_flatten_and_deep_1() { #[test] fn table_expand_record_0() { - let actual = nu!(r#"[{c: {d: 1}}] | table --expand"#); + let actual = nu!("[{c: {d: 1}}] | table --expand"); assert_eq!( actual.out, @@ -421,8 +421,7 @@ fn table_expand_record_0() { #[test] fn table_expand_record_1() { - let actual = - nu!(r#"[[a b, c]; [1 2 3] [4 5 [1 2 {a: 123, b: 234, c: 345}]]] | table --expand"#); + let actual = nu!("[[a b, c]; [1 2 3] [4 5 [1 2 {a: 123, b: 234, c: 345}]]] | table --expand"); assert_eq!( actual.out, @@ -505,9 +504,9 @@ fn external_with_too_much_stdout_should_not_hang_nu() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " cat a_large_file.txt | table - "# + " )); assert_eq!(actual.out, large_file_body); @@ -516,13 +515,13 @@ fn external_with_too_much_stdout_should_not_hang_nu() { #[test] fn table_pagging_row_offset_overlap() { - let actual = nu!(r#"0..1000"#); + let actual = nu!("0..1000"); assert_eq!(actual.out, "╭─────┬─────╮│ 0 │ 0 ││ 1 │ 1 ││ 2 │ 2 ││ 3 │ 3 ││ 4 │ 4 ││ 5 │ 5 ││ 6 │ 6 ││ 7 │ 7 ││ 8 │ 8 ││ 9 │ 9 ││ 10 │ 10 ││ 11 │ 11 ││ 12 │ 12 ││ 13 │ 13 ││ 14 │ 14 ││ 15 │ 15 ││ 16 │ 16 ││ 17 │ 17 ││ 18 │ 18 ││ 19 │ 19 ││ 20 │ 20 ││ 21 │ 21 ││ 22 │ 22 ││ 23 │ 23 ││ 24 │ 24 ││ 25 │ 25 ││ 26 │ 26 ││ 27 │ 27 ││ 28 │ 28 ││ 29 │ 29 ││ 30 │ 30 ││ 31 │ 31 ││ 32 │ 32 ││ 33 │ 33 ││ 34 │ 34 ││ 35 │ 35 ││ 36 │ 36 ││ 37 │ 37 ││ 38 │ 38 ││ 39 │ 39 ││ 40 │ 40 ││ 41 │ 41 ││ 42 │ 42 ││ 43 │ 43 ││ 44 │ 44 ││ 45 │ 45 ││ 46 │ 46 ││ 47 │ 47 ││ 48 │ 48 ││ 49 │ 49 ││ 50 │ 50 ││ 51 │ 51 ││ 52 │ 52 ││ 53 │ 53 ││ 54 │ 54 ││ 55 │ 55 ││ 56 │ 56 ││ 57 │ 57 ││ 58 │ 58 ││ 59 │ 59 ││ 60 │ 60 ││ 61 │ 61 ││ 62 │ 62 ││ 63 │ 63 ││ 64 │ 64 ││ 65 │ 65 ││ 66 │ 66 ││ 67 │ 67 ││ 68 │ 68 ││ 69 │ 69 ││ 70 │ 70 ││ 71 │ 71 ││ 72 │ 72 ││ 73 │ 73 ││ 74 │ 74 ││ 75 │ 75 ││ 76 │ 76 ││ 77 │ 77 ││ 78 │ 78 ││ 79 │ 79 ││ 80 │ 80 ││ 81 │ 81 ││ 82 │ 82 ││ 83 │ 83 ││ 84 │ 84 ││ 85 │ 85 ││ 86 │ 86 ││ 87 │ 87 ││ 88 │ 88 ││ 89 │ 89 ││ 90 │ 90 ││ 91 │ 91 ││ 92 │ 92 ││ 93 │ 93 ││ 94 │ 94 ││ 95 │ 95 ││ 96 │ 96 ││ 97 │ 97 ││ 98 │ 98 ││ 99 │ 99 ││ 100 │ 100 ││ 101 │ 101 ││ 102 │ 102 ││ 103 │ 103 ││ 104 │ 104 ││ 105 │ 105 ││ 106 │ 106 ││ 107 │ 107 ││ 108 │ 108 ││ 109 │ 109 ││ 110 │ 110 ││ 111 │ 111 ││ 112 │ 112 ││ 113 │ 113 ││ 114 │ 114 ││ 115 │ 115 ││ 116 │ 116 ││ 117 │ 117 ││ 118 │ 118 ││ 119 │ 119 ││ 120 │ 120 ││ 121 │ 121 ││ 122 │ 122 ││ 123 │ 123 ││ 124 │ 124 ││ 125 │ 125 ││ 126 │ 126 ││ 127 │ 127 ││ 128 │ 128 ││ 129 │ 129 ││ 130 │ 130 ││ 131 │ 131 ││ 132 │ 132 ││ 133 │ 133 ││ 134 │ 134 ││ 135 │ 135 ││ 136 │ 136 ││ 137 │ 137 ││ 138 │ 138 ││ 139 │ 139 ││ 140 │ 140 ││ 141 │ 141 ││ 142 │ 142 ││ 143 │ 143 ││ 144 │ 144 ││ 145 │ 145 ││ 146 │ 146 ││ 147 │ 147 ││ 148 │ 148 ││ 149 │ 149 ││ 150 │ 150 ││ 151 │ 151 ││ 152 │ 152 ││ 153 │ 153 ││ 154 │ 154 ││ 155 │ 155 ││ 156 │ 156 ││ 157 │ 157 ││ 158 │ 158 ││ 159 │ 159 ││ 160 │ 160 ││ 161 │ 161 ││ 162 │ 162 ││ 163 │ 163 ││ 164 │ 164 ││ 165 │ 165 ││ 166 │ 166 ││ 167 │ 167 ││ 168 │ 168 ││ 169 │ 169 ││ 170 │ 170 ││ 171 │ 171 ││ 172 │ 172 ││ 173 │ 173 ││ 174 │ 174 ││ 175 │ 175 ││ 176 │ 176 ││ 177 │ 177 ││ 178 │ 178 ││ 179 │ 179 ││ 180 │ 180 ││ 181 │ 181 ││ 182 │ 182 ││ 183 │ 183 ││ 184 │ 184 ││ 185 │ 185 ││ 186 │ 186 ││ 187 │ 187 ││ 188 │ 188 ││ 189 │ 189 ││ 190 │ 190 ││ 191 │ 191 ││ 192 │ 192 ││ 193 │ 193 ││ 194 │ 194 ││ 195 │ 195 ││ 196 │ 196 ││ 197 │ 197 ││ 198 │ 198 ││ 199 │ 199 ││ 200 │ 200 ││ 201 │ 201 ││ 202 │ 202 ││ 203 │ 203 ││ 204 │ 204 ││ 205 │ 205 ││ 206 │ 206 ││ 207 │ 207 ││ 208 │ 208 ││ 209 │ 209 ││ 210 │ 210 ││ 211 │ 211 ││ 212 │ 212 ││ 213 │ 213 ││ 214 │ 214 ││ 215 │ 215 ││ 216 │ 216 ││ 217 │ 217 ││ 218 │ 218 ││ 219 │ 219 ││ 220 │ 220 ││ 221 │ 221 ││ 222 │ 222 ││ 223 │ 223 ││ 224 │ 224 ││ 225 │ 225 ││ 226 │ 226 ││ 227 │ 227 ││ 228 │ 228 ││ 229 │ 229 ││ 230 │ 230 ││ 231 │ 231 ││ 232 │ 232 ││ 233 │ 233 ││ 234 │ 234 ││ 235 │ 235 ││ 236 │ 236 ││ 237 │ 237 ││ 238 │ 238 ││ 239 │ 239 ││ 240 │ 240 ││ 241 │ 241 ││ 242 │ 242 ││ 243 │ 243 ││ 244 │ 244 ││ 245 │ 245 ││ 246 │ 246 ││ 247 │ 247 ││ 248 │ 248 ││ 249 │ 249 ││ 250 │ 250 ││ 251 │ 251 ││ 252 │ 252 ││ 253 │ 253 ││ 254 │ 254 ││ 255 │ 255 ││ 256 │ 256 ││ 257 │ 257 ││ 258 │ 258 ││ 259 │ 259 ││ 260 │ 260 ││ 261 │ 261 ││ 262 │ 262 ││ 263 │ 263 ││ 264 │ 264 ││ 265 │ 265 ││ 266 │ 266 ││ 267 │ 267 ││ 268 │ 268 ││ 269 │ 269 ││ 270 │ 270 ││ 271 │ 271 ││ 272 │ 272 ││ 273 │ 273 ││ 274 │ 274 ││ 275 │ 275 ││ 276 │ 276 ││ 277 │ 277 ││ 278 │ 278 ││ 279 │ 279 ││ 280 │ 280 ││ 281 │ 281 ││ 282 │ 282 ││ 283 │ 283 ││ 284 │ 284 ││ 285 │ 285 ││ 286 │ 286 ││ 287 │ 287 ││ 288 │ 288 ││ 289 │ 289 ││ 290 │ 290 ││ 291 │ 291 ││ 292 │ 292 ││ 293 │ 293 ││ 294 │ 294 ││ 295 │ 295 ││ 296 │ 296 ││ 297 │ 297 ││ 298 │ 298 ││ 299 │ 299 ││ 300 │ 300 ││ 301 │ 301 ││ 302 │ 302 ││ 303 │ 303 ││ 304 │ 304 ││ 305 │ 305 ││ 306 │ 306 ││ 307 │ 307 ││ 308 │ 308 ││ 309 │ 309 ││ 310 │ 310 ││ 311 │ 311 ││ 312 │ 312 ││ 313 │ 313 ││ 314 │ 314 ││ 315 │ 315 ││ 316 │ 316 ││ 317 │ 317 ││ 318 │ 318 ││ 319 │ 319 ││ 320 │ 320 ││ 321 │ 321 ││ 322 │ 322 ││ 323 │ 323 ││ 324 │ 324 ││ 325 │ 325 ││ 326 │ 326 ││ 327 │ 327 ││ 328 │ 328 ││ 329 │ 329 ││ 330 │ 330 ││ 331 │ 331 ││ 332 │ 332 ││ 333 │ 333 ││ 334 │ 334 ││ 335 │ 335 ││ 336 │ 336 ││ 337 │ 337 ││ 338 │ 338 ││ 339 │ 339 ││ 340 │ 340 ││ 341 │ 341 ││ 342 │ 342 ││ 343 │ 343 ││ 344 │ 344 ││ 345 │ 345 ││ 346 │ 346 ││ 347 │ 347 ││ 348 │ 348 ││ 349 │ 349 ││ 350 │ 350 ││ 351 │ 351 ││ 352 │ 352 ││ 353 │ 353 ││ 354 │ 354 ││ 355 │ 355 ││ 356 │ 356 ││ 357 │ 357 ││ 358 │ 358 ││ 359 │ 359 ││ 360 │ 360 ││ 361 │ 361 ││ 362 │ 362 ││ 363 │ 363 ││ 364 │ 364 ││ 365 │ 365 ││ 366 │ 366 ││ 367 │ 367 ││ 368 │ 368 ││ 369 │ 369 ││ 370 │ 370 ││ 371 │ 371 ││ 372 │ 372 ││ 373 │ 373 ││ 374 │ 374 ││ 375 │ 375 ││ 376 │ 376 ││ 377 │ 377 ││ 378 │ 378 ││ 379 │ 379 ││ 380 │ 380 ││ 381 │ 381 ││ 382 │ 382 ││ 383 │ 383 ││ 384 │ 384 ││ 385 │ 385 ││ 386 │ 386 ││ 387 │ 387 ││ 388 │ 388 ││ 389 │ 389 ││ 390 │ 390 ││ 391 │ 391 ││ 392 │ 392 ││ 393 │ 393 ││ 394 │ 394 ││ 395 │ 395 ││ 396 │ 396 ││ 397 │ 397 ││ 398 │ 398 ││ 399 │ 399 ││ 400 │ 400 ││ 401 │ 401 ││ 402 │ 402 ││ 403 │ 403 ││ 404 │ 404 ││ 405 │ 405 ││ 406 │ 406 ││ 407 │ 407 ││ 408 │ 408 ││ 409 │ 409 ││ 410 │ 410 ││ 411 │ 411 ││ 412 │ 412 ││ 413 │ 413 ││ 414 │ 414 ││ 415 │ 415 ││ 416 │ 416 ││ 417 │ 417 ││ 418 │ 418 ││ 419 │ 419 ││ 420 │ 420 ││ 421 │ 421 ││ 422 │ 422 ││ 423 │ 423 ││ 424 │ 424 ││ 425 │ 425 ││ 426 │ 426 ││ 427 │ 427 ││ 428 │ 428 ││ 429 │ 429 ││ 430 │ 430 ││ 431 │ 431 ││ 432 │ 432 ││ 433 │ 433 ││ 434 │ 434 ││ 435 │ 435 ││ 436 │ 436 ││ 437 │ 437 ││ 438 │ 438 ││ 439 │ 439 ││ 440 │ 440 ││ 441 │ 441 ││ 442 │ 442 ││ 443 │ 443 ││ 444 │ 444 ││ 445 │ 445 ││ 446 │ 446 ││ 447 │ 447 ││ 448 │ 448 ││ 449 │ 449 ││ 450 │ 450 ││ 451 │ 451 ││ 452 │ 452 ││ 453 │ 453 ││ 454 │ 454 ││ 455 │ 455 ││ 456 │ 456 ││ 457 │ 457 ││ 458 │ 458 ││ 459 │ 459 ││ 460 │ 460 ││ 461 │ 461 ││ 462 │ 462 ││ 463 │ 463 ││ 464 │ 464 ││ 465 │ 465 ││ 466 │ 466 ││ 467 │ 467 ││ 468 │ 468 ││ 469 │ 469 ││ 470 │ 470 ││ 471 │ 471 ││ 472 │ 472 ││ 473 │ 473 ││ 474 │ 474 ││ 475 │ 475 ││ 476 │ 476 ││ 477 │ 477 ││ 478 │ 478 ││ 479 │ 479 ││ 480 │ 480 ││ 481 │ 481 ││ 482 │ 482 ││ 483 │ 483 ││ 484 │ 484 ││ 485 │ 485 ││ 486 │ 486 ││ 487 │ 487 ││ 488 │ 488 ││ 489 │ 489 ││ 490 │ 490 ││ 491 │ 491 ││ 492 │ 492 ││ 493 │ 493 ││ 494 │ 494 ││ 495 │ 495 ││ 496 │ 496 ││ 497 │ 497 ││ 498 │ 498 ││ 499 │ 499 ││ 500 │ 500 ││ 501 │ 501 ││ 502 │ 502 ││ 503 │ 503 ││ 504 │ 504 ││ 505 │ 505 ││ 506 │ 506 ││ 507 │ 507 ││ 508 │ 508 ││ 509 │ 509 ││ 510 │ 510 ││ 511 │ 511 ││ 512 │ 512 ││ 513 │ 513 ││ 514 │ 514 ││ 515 │ 515 ││ 516 │ 516 ││ 517 │ 517 ││ 518 │ 518 ││ 519 │ 519 ││ 520 │ 520 ││ 521 │ 521 ││ 522 │ 522 ││ 523 │ 523 ││ 524 │ 524 ││ 525 │ 525 ││ 526 │ 526 ││ 527 │ 527 ││ 528 │ 528 ││ 529 │ 529 ││ 530 │ 530 ││ 531 │ 531 ││ 532 │ 532 ││ 533 │ 533 ││ 534 │ 534 ││ 535 │ 535 ││ 536 │ 536 ││ 537 │ 537 ││ 538 │ 538 ││ 539 │ 539 ││ 540 │ 540 ││ 541 │ 541 ││ 542 │ 542 ││ 543 │ 543 ││ 544 │ 544 ││ 545 │ 545 ││ 546 │ 546 ││ 547 │ 547 ││ 548 │ 548 ││ 549 │ 549 ││ 550 │ 550 ││ 551 │ 551 ││ 552 │ 552 ││ 553 │ 553 ││ 554 │ 554 ││ 555 │ 555 ││ 556 │ 556 ││ 557 │ 557 ││ 558 │ 558 ││ 559 │ 559 ││ 560 │ 560 ││ 561 │ 561 ││ 562 │ 562 ││ 563 │ 563 ││ 564 │ 564 ││ 565 │ 565 ││ 566 │ 566 ││ 567 │ 567 ││ 568 │ 568 ││ 569 │ 569 ││ 570 │ 570 ││ 571 │ 571 ││ 572 │ 572 ││ 573 │ 573 ││ 574 │ 574 ││ 575 │ 575 ││ 576 │ 576 ││ 577 │ 577 ││ 578 │ 578 ││ 579 │ 579 ││ 580 │ 580 ││ 581 │ 581 ││ 582 │ 582 ││ 583 │ 583 ││ 584 │ 584 ││ 585 │ 585 ││ 586 │ 586 ││ 587 │ 587 ││ 588 │ 588 ││ 589 │ 589 ││ 590 │ 590 ││ 591 │ 591 ││ 592 │ 592 ││ 593 │ 593 ││ 594 │ 594 ││ 595 │ 595 ││ 596 │ 596 ││ 597 │ 597 ││ 598 │ 598 ││ 599 │ 599 ││ 600 │ 600 ││ 601 │ 601 ││ 602 │ 602 ││ 603 │ 603 ││ 604 │ 604 ││ 605 │ 605 ││ 606 │ 606 ││ 607 │ 607 ││ 608 │ 608 ││ 609 │ 609 ││ 610 │ 610 ││ 611 │ 611 ││ 612 │ 612 ││ 613 │ 613 ││ 614 │ 614 ││ 615 │ 615 ││ 616 │ 616 ││ 617 │ 617 ││ 618 │ 618 ││ 619 │ 619 ││ 620 │ 620 ││ 621 │ 621 ││ 622 │ 622 ││ 623 │ 623 ││ 624 │ 624 ││ 625 │ 625 ││ 626 │ 626 ││ 627 │ 627 ││ 628 │ 628 ││ 629 │ 629 ││ 630 │ 630 ││ 631 │ 631 ││ 632 │ 632 ││ 633 │ 633 ││ 634 │ 634 ││ 635 │ 635 ││ 636 │ 636 ││ 637 │ 637 ││ 638 │ 638 ││ 639 │ 639 ││ 640 │ 640 ││ 641 │ 641 ││ 642 │ 642 ││ 643 │ 643 ││ 644 │ 644 ││ 645 │ 645 ││ 646 │ 646 ││ 647 │ 647 ││ 648 │ 648 ││ 649 │ 649 ││ 650 │ 650 ││ 651 │ 651 ││ 652 │ 652 ││ 653 │ 653 ││ 654 │ 654 ││ 655 │ 655 ││ 656 │ 656 ││ 657 │ 657 ││ 658 │ 658 ││ 659 │ 659 ││ 660 │ 660 ││ 661 │ 661 ││ 662 │ 662 ││ 663 │ 663 ││ 664 │ 664 ││ 665 │ 665 ││ 666 │ 666 ││ 667 │ 667 ││ 668 │ 668 ││ 669 │ 669 ││ 670 │ 670 ││ 671 │ 671 ││ 672 │ 672 ││ 673 │ 673 ││ 674 │ 674 ││ 675 │ 675 ││ 676 │ 676 ││ 677 │ 677 ││ 678 │ 678 ││ 679 │ 679 ││ 680 │ 680 ││ 681 │ 681 ││ 682 │ 682 ││ 683 │ 683 ││ 684 │ 684 ││ 685 │ 685 ││ 686 │ 686 ││ 687 │ 687 ││ 688 │ 688 ││ 689 │ 689 ││ 690 │ 690 ││ 691 │ 691 ││ 692 │ 692 ││ 693 │ 693 ││ 694 │ 694 ││ 695 │ 695 ││ 696 │ 696 ││ 697 │ 697 ││ 698 │ 698 ││ 699 │ 699 ││ 700 │ 700 ││ 701 │ 701 ││ 702 │ 702 ││ 703 │ 703 ││ 704 │ 704 ││ 705 │ 705 ││ 706 │ 706 ││ 707 │ 707 ││ 708 │ 708 ││ 709 │ 709 ││ 710 │ 710 ││ 711 │ 711 ││ 712 │ 712 ││ 713 │ 713 ││ 714 │ 714 ││ 715 │ 715 ││ 716 │ 716 ││ 717 │ 717 ││ 718 │ 718 ││ 719 │ 719 ││ 720 │ 720 ││ 721 │ 721 ││ 722 │ 722 ││ 723 │ 723 ││ 724 │ 724 ││ 725 │ 725 ││ 726 │ 726 ││ 727 │ 727 ││ 728 │ 728 ││ 729 │ 729 ││ 730 │ 730 ││ 731 │ 731 ││ 732 │ 732 ││ 733 │ 733 ││ 734 │ 734 ││ 735 │ 735 ││ 736 │ 736 ││ 737 │ 737 ││ 738 │ 738 ││ 739 │ 739 ││ 740 │ 740 ││ 741 │ 741 ││ 742 │ 742 ││ 743 │ 743 ││ 744 │ 744 ││ 745 │ 745 ││ 746 │ 746 ││ 747 │ 747 ││ 748 │ 748 ││ 749 │ 749 ││ 750 │ 750 ││ 751 │ 751 ││ 752 │ 752 ││ 753 │ 753 ││ 754 │ 754 ││ 755 │ 755 ││ 756 │ 756 ││ 757 │ 757 ││ 758 │ 758 ││ 759 │ 759 ││ 760 │ 760 ││ 761 │ 761 ││ 762 │ 762 ││ 763 │ 763 ││ 764 │ 764 ││ 765 │ 765 ││ 766 │ 766 ││ 767 │ 767 ││ 768 │ 768 ││ 769 │ 769 ││ 770 │ 770 ││ 771 │ 771 ││ 772 │ 772 ││ 773 │ 773 ││ 774 │ 774 ││ 775 │ 775 ││ 776 │ 776 ││ 777 │ 777 ││ 778 │ 778 ││ 779 │ 779 ││ 780 │ 780 ││ 781 │ 781 ││ 782 │ 782 ││ 783 │ 783 ││ 784 │ 784 ││ 785 │ 785 ││ 786 │ 786 ││ 787 │ 787 ││ 788 │ 788 ││ 789 │ 789 ││ 790 │ 790 ││ 791 │ 791 ││ 792 │ 792 ││ 793 │ 793 ││ 794 │ 794 ││ 795 │ 795 ││ 796 │ 796 ││ 797 │ 797 ││ 798 │ 798 ││ 799 │ 799 ││ 800 │ 800 ││ 801 │ 801 ││ 802 │ 802 ││ 803 │ 803 ││ 804 │ 804 ││ 805 │ 805 ││ 806 │ 806 ││ 807 │ 807 ││ 808 │ 808 ││ 809 │ 809 ││ 810 │ 810 ││ 811 │ 811 ││ 812 │ 812 ││ 813 │ 813 ││ 814 │ 814 ││ 815 │ 815 ││ 816 │ 816 ││ 817 │ 817 ││ 818 │ 818 ││ 819 │ 819 ││ 820 │ 820 ││ 821 │ 821 ││ 822 │ 822 ││ 823 │ 823 ││ 824 │ 824 ││ 825 │ 825 ││ 826 │ 826 ││ 827 │ 827 ││ 828 │ 828 ││ 829 │ 829 ││ 830 │ 830 ││ 831 │ 831 ││ 832 │ 832 ││ 833 │ 833 ││ 834 │ 834 ││ 835 │ 835 ││ 836 │ 836 ││ 837 │ 837 ││ 838 │ 838 ││ 839 │ 839 ││ 840 │ 840 ││ 841 │ 841 ││ 842 │ 842 ││ 843 │ 843 ││ 844 │ 844 ││ 845 │ 845 ││ 846 │ 846 ││ 847 │ 847 ││ 848 │ 848 ││ 849 │ 849 ││ 850 │ 850 ││ 851 │ 851 ││ 852 │ 852 ││ 853 │ 853 ││ 854 │ 854 ││ 855 │ 855 ││ 856 │ 856 ││ 857 │ 857 ││ 858 │ 858 ││ 859 │ 859 ││ 860 │ 860 ││ 861 │ 861 ││ 862 │ 862 ││ 863 │ 863 ││ 864 │ 864 ││ 865 │ 865 ││ 866 │ 866 ││ 867 │ 867 ││ 868 │ 868 ││ 869 │ 869 ││ 870 │ 870 ││ 871 │ 871 ││ 872 │ 872 ││ 873 │ 873 ││ 874 │ 874 ││ 875 │ 875 ││ 876 │ 876 ││ 877 │ 877 ││ 878 │ 878 ││ 879 │ 879 ││ 880 │ 880 ││ 881 │ 881 ││ 882 │ 882 ││ 883 │ 883 ││ 884 │ 884 ││ 885 │ 885 ││ 886 │ 886 ││ 887 │ 887 ││ 888 │ 888 ││ 889 │ 889 ││ 890 │ 890 ││ 891 │ 891 ││ 892 │ 892 ││ 893 │ 893 ││ 894 │ 894 ││ 895 │ 895 ││ 896 │ 896 ││ 897 │ 897 ││ 898 │ 898 ││ 899 │ 899 ││ 900 │ 900 ││ 901 │ 901 ││ 902 │ 902 ││ 903 │ 903 ││ 904 │ 904 ││ 905 │ 905 ││ 906 │ 906 ││ 907 │ 907 ││ 908 │ 908 ││ 909 │ 909 ││ 910 │ 910 ││ 911 │ 911 ││ 912 │ 912 ││ 913 │ 913 ││ 914 │ 914 ││ 915 │ 915 ││ 916 │ 916 ││ 917 │ 917 ││ 918 │ 918 ││ 919 │ 919 ││ 920 │ 920 ││ 921 │ 921 ││ 922 │ 922 ││ 923 │ 923 ││ 924 │ 924 ││ 925 │ 925 ││ 926 │ 926 ││ 927 │ 927 ││ 928 │ 928 ││ 929 │ 929 ││ 930 │ 930 ││ 931 │ 931 ││ 932 │ 932 ││ 933 │ 933 ││ 934 │ 934 ││ 935 │ 935 ││ 936 │ 936 ││ 937 │ 937 ││ 938 │ 938 ││ 939 │ 939 ││ 940 │ 940 ││ 941 │ 941 ││ 942 │ 942 ││ 943 │ 943 ││ 944 │ 944 ││ 945 │ 945 ││ 946 │ 946 ││ 947 │ 947 ││ 948 │ 948 ││ 949 │ 949 ││ 950 │ 950 ││ 951 │ 951 ││ 952 │ 952 ││ 953 │ 953 ││ 954 │ 954 ││ 955 │ 955 ││ 956 │ 956 ││ 957 │ 957 ││ 958 │ 958 ││ 959 │ 959 ││ 960 │ 960 ││ 961 │ 961 ││ 962 │ 962 ││ 963 │ 963 ││ 964 │ 964 ││ 965 │ 965 ││ 966 │ 966 ││ 967 │ 967 ││ 968 │ 968 ││ 969 │ 969 ││ 970 │ 970 ││ 971 │ 971 ││ 972 │ 972 ││ 973 │ 973 ││ 974 │ 974 ││ 975 │ 975 ││ 976 │ 976 ││ 977 │ 977 ││ 978 │ 978 ││ 979 │ 979 ││ 980 │ 980 ││ 981 │ 981 ││ 982 │ 982 ││ 983 │ 983 ││ 984 │ 984 ││ 985 │ 985 ││ 986 │ 986 ││ 987 │ 987 ││ 988 │ 988 ││ 989 │ 989 ││ 990 │ 990 ││ 991 │ 991 ││ 992 │ 992 ││ 993 │ 993 ││ 994 │ 994 ││ 995 │ 995 ││ 996 │ 996 ││ 997 │ 997 ││ 998 │ 998 ││ 999 │ 999 │╰─────┴─────╯╭──────┬──────╮│ 1000 │ 1000 │╰──────┴──────╯"); } #[test] fn table_index_0() { - let actual = nu!(r#"[1 3 1 3 2 1 1]"#); + let actual = nu!("[1 3 1 3 2 1 1]"); assert_eq!( actual.out, "╭───┬───╮│ 0 │ 1 ││ 1 │ 3 ││ 2 │ 1 ││ 3 │ 3 ││ 4 │ 2 ││ 5 │ 1 ││ 6 │ 1 │╰───┴───╯" @@ -2372,7 +2371,7 @@ fn _split_str_by_width(s: &str, w: usize) -> Vec { #[test] fn table_expand_index_offset() { - let actual = nu!(r#"1..1002 | table --expand"#); + let actual = nu!("1..1002 | table --expand"); let suffix = "╭──────┬──────╮│ 1000 │ 1001 ││ 1001 │ 1002 │╰──────┴──────╯"; let expected_suffix = actual.out.strip_suffix(suffix); assert!(expected_suffix.is_some(), "{:?}", actual.out); @@ -2380,7 +2379,7 @@ fn table_expand_index_offset() { #[test] fn table_index_offset() { - let actual = nu!(r#"1..1002 | table"#); + let actual = nu!("1..1002 | table"); let suffix = "╭──────┬──────╮│ 1000 │ 1001 ││ 1001 │ 1002 │╰──────┴──────╯"; let expected_suffix = actual.out.strip_suffix(suffix); assert!(expected_suffix.is_some(), "{:?}", actual.out); diff --git a/crates/nu-command/tests/commands/touch.rs b/crates/nu-command/tests/commands/touch.rs index 3b30ab250..3b0d55f0f 100644 --- a/crates/nu-command/tests/commands/touch.rs +++ b/crates/nu-command/tests/commands/touch.rs @@ -105,7 +105,7 @@ fn not_create_file_if_it_not_exists() { Playground::setup("change_time_test_28", |dirs, _sandbox| { nu!( cwd: dirs.test(), - r#"touch -c file.txt"# + "touch -c file.txt" ); let path = dirs.test().join("file.txt"); @@ -114,7 +114,7 @@ fn not_create_file_if_it_not_exists() { nu!( cwd: dirs.test(), - r#"touch -c file.txt"# + "touch -c file.txt" ); let path = dirs.test().join("file.txt"); diff --git a/crates/nu-command/tests/commands/uniq.rs b/crates/nu-command/tests/commands/uniq.rs index e13b2671e..1cd590502 100644 --- a/crates/nu-command/tests/commands/uniq.rs +++ b/crates/nu-command/tests/commands/uniq.rs @@ -19,11 +19,11 @@ fn removes_duplicate_rows() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open los_tres_caballeros.csv | uniq | length - "# + " )); assert_eq!(actual.out, "3"); @@ -47,12 +47,12 @@ fn uniq_values() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open los_tres_caballeros.csv | select type | uniq | length - "# + " )); assert_eq!(actual.out, "2"); @@ -119,11 +119,11 @@ fn nested_json_structures() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open nested_json_structures.json | uniq | length - "# + " )); assert_eq!(actual.out, "3"); }) @@ -195,10 +195,10 @@ fn uniq_simple_vals_strs() { #[test] fn table() { let actual = nu!(pipeline( - r#" + " [[fruit day]; [apple monday] [apple friday] [Apple friday] [apple monday] [pear monday] [orange tuesday]] | uniq - "# + " )); let expected = nu!("[[fruit day]; [apple monday] [apple friday] [Apple friday] [pear monday] [orange tuesday]]"); diff --git a/crates/nu-command/tests/commands/uniq_by.rs b/crates/nu-command/tests/commands/uniq_by.rs index 5f0d0cfe8..dc38c72fc 100644 --- a/crates/nu-command/tests/commands/uniq_by.rs +++ b/crates/nu-command/tests/commands/uniq_by.rs @@ -18,11 +18,11 @@ fn removes_duplicate_rows() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open los_tres_caballeros.csv | uniq-by last_name | length - "# + " )); assert_eq!(actual.out, "3"); @@ -69,12 +69,12 @@ fn uniq_counting() { #[test] fn uniq_unique() { let actual = nu!(pipeline( - r#" + " echo [1 2 3 4 1 5] | wrap item | uniq-by item --unique | get item - "# + " )); let expected = nu!("[2 3 4 5]"); assert_eq!(actual.out, expected.out); @@ -83,16 +83,16 @@ fn uniq_unique() { #[test] fn table() { let actual = nu!(pipeline( - r#" + " [[fruit day]; [apple monday] [apple friday] [Apple friday] [apple monday] [pear monday] [orange tuesday]] | uniq-by fruit - "# + " )); let expected = nu!(pipeline( - r#" + " echo [[fruit day]; [apple monday] [Apple friday] [pear monday] [orange tuesday]] - "# + " )); print!("{}", actual.out); print!("{}", expected.out); @@ -109,16 +109,16 @@ fn uniq_by_empty() { #[test] fn uniq_by_multiple_columns() { let actual = nu!(pipeline( - r#" + " [[fruit day]; [apple monday] [apple friday] [Apple friday] [apple monday] [pear monday] [orange tuesday]] | uniq-by fruit day - "# + " )); let expected = nu!(pipeline( - r#" + " echo [[fruit day]; [apple monday] [apple friday] [Apple friday] [pear monday] [orange tuesday]] - "# + " )); assert_eq!(actual.out, expected.out); } diff --git a/crates/nu-command/tests/commands/update.rs b/crates/nu-command/tests/commands/update.rs index 866897c51..188507cab 100644 --- a/crates/nu-command/tests/commands/update.rs +++ b/crates/nu-command/tests/commands/update.rs @@ -26,11 +26,11 @@ fn doesnt_convert_record_to_table() { fn sets_the_column_from_a_block_run_output() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open cargo_sample.toml | update dev-dependencies.pretty_assertions { open cargo_sample.toml | get dev-dependencies.pretty_assertions | inc --minor } | get dev-dependencies.pretty_assertions - "# + " )); assert_eq!(actual.out, "0.7.0"); diff --git a/crates/nu-command/tests/commands/upsert.rs b/crates/nu-command/tests/commands/upsert.rs index 34ce8ac41..ff3b644a0 100644 --- a/crates/nu-command/tests/commands/upsert.rs +++ b/crates/nu-command/tests/commands/upsert.rs @@ -25,11 +25,11 @@ fn doesnt_convert_record_to_table() { fn sets_the_column_from_a_block_run_output() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open cargo_sample.toml | upsert dev-dependencies.pretty_assertions { open cargo_sample.toml | get dev-dependencies.pretty_assertions | inc --minor } | get dev-dependencies.pretty_assertions - "# + " )); assert_eq!(actual.out, "0.7.0"); @@ -68,7 +68,7 @@ fn sets_the_column_from_a_subexpression() { #[test] fn upsert_uses_enumerate_index_inserting() { let actual = nu!( - r#"[[a]; [7] [6]] | enumerate | upsert b {|el| $el.index + 1 + $el.item.a } | flatten | to nuon"# + "[[a]; [7] [6]] | enumerate | upsert b {|el| $el.index + 1 + $el.item.a } | flatten | to nuon" ); assert_eq!(actual.out, "[[index, a, b]; [0, 7, 8], [1, 6, 8]]"); diff --git a/crates/nu-command/tests/commands/use_.rs b/crates/nu-command/tests/commands/use_.rs index 705ab24e7..647d054fe 100644 --- a/crates/nu-command/tests/commands/use_.rs +++ b/crates/nu-command/tests/commands/use_.rs @@ -20,13 +20,13 @@ fn use_module_file_within_block() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " def bar [] { use spam.nu foo; foo }; bar - "# + " ) ); @@ -53,10 +53,10 @@ fn use_keeps_doc_comments() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " use spam.nu foo; help foo - "# + " ) ); diff --git a/crates/nu-command/tests/commands/where_.rs b/crates/nu-command/tests/commands/where_.rs index 50bd35e29..847877410 100644 --- a/crates/nu-command/tests/commands/where_.rs +++ b/crates/nu-command/tests/commands/where_.rs @@ -81,65 +81,65 @@ fn where_uses_enumerate_index() { fn binary_operator_comparisons() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open sample.db | get ints | first 4 | where z > 4200 | get z.0 - "# + " )); assert_eq!(actual.out, "4253"); let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open sample.db | get ints | first 4 | where z >= 4253 | get z.0 - "# + " )); assert_eq!(actual.out, "4253"); let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open sample.db | get ints | first 4 | where z < 10 | get z.0 - "# + " )); assert_eq!(actual.out, "1"); let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open sample.db | get ints | first 4 | where z <= 1 | get z.0 - "# + " )); assert_eq!(actual.out, "1"); let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open sample.db | get ints | where z != 1 | first | get z - "# + " )); assert_eq!(actual.out, "42"); @@ -150,24 +150,24 @@ fn binary_operator_comparisons() { fn contains_operator() { let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open sample.db | get strings | where x =~ ell | length - "# + " )); assert_eq!(actual.out, "4"); let actual = nu!( cwd: "tests/fixtures/formats", pipeline( - r#" + " open sample.db | get strings | where x !~ ell | length - "# + " )); assert_eq!(actual.out, "2"); diff --git a/crates/nu-command/tests/commands/wrap.rs b/crates/nu-command/tests/commands/wrap.rs index 597fb99df..30e28ab9a 100644 --- a/crates/nu-command/tests/commands/wrap.rs +++ b/crates/nu-command/tests/commands/wrap.rs @@ -17,14 +17,14 @@ fn wrap_rows_into_a_row() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open los_tres_caballeros.txt | from csv | wrap caballeros | get caballeros | get 0 | get last_name - "# + " )); assert_eq!(actual.out, "Robalino"); @@ -46,14 +46,14 @@ fn wrap_rows_into_a_table() { let actual = nu!( cwd: dirs.test(), pipeline( - r#" + " open los_tres_caballeros.txt | from csv | get last_name | wrap caballero | get 2 | get caballero - "# + " )); assert_eq!(actual.out, "Katz"); diff --git a/crates/nu-command/tests/commands/zip.rs b/crates/nu-command/tests/commands/zip.rs index db895596b..b8915cb89 100644 --- a/crates/nu-command/tests/commands/zip.rs +++ b/crates/nu-command/tests/commands/zip.rs @@ -23,7 +23,7 @@ fn zips_two_tables() { )]); let actual = nu!(pipeline(&format!( - r#" + " use {} expect ; let contributors = ([ @@ -35,7 +35,7 @@ fn zips_two_tables() { let actual = ($contributors | upsert commits {{ |i| ($i.commits + 10) }}); expect $actual --to-eq [[name, commits]; [andres, 20] [jt, 30]] - "#, + ", dirs.test().join("zip_test.nu").display() )));