mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 07:48:19 +02:00
Remove it expansion (#2701)
* Remove it-expansion, take 2 * Cleanup * silly update to test CI
This commit is contained in:
@ -21,7 +21,6 @@ fn adds_a_row_to_the_end() {
|
||||
| lines
|
||||
| append "pollo loco"
|
||||
| nth 3
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -71,7 +71,7 @@ fn cal_sees_pipeline_year() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
echo 1020 | cal --full-year $it | get monday | first 3 | to json
|
||||
cal --full-year 1020 | get monday | first 3 | to json
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -10,7 +10,7 @@ fn filesystem_change_from_current_directory_using_relative_path() {
|
||||
cwd: dirs.root(),
|
||||
r#"
|
||||
cd cd_test_1
|
||||
pwd | echo $it
|
||||
echo $(pwd)
|
||||
"#
|
||||
);
|
||||
|
||||
@ -25,7 +25,7 @@ fn filesystem_change_from_current_directory_using_absolute_path() {
|
||||
cwd: dirs.test(),
|
||||
r#"
|
||||
cd "{}"
|
||||
pwd | echo $it
|
||||
echo $(pwd)
|
||||
"#,
|
||||
dirs.formats()
|
||||
);
|
||||
@ -44,7 +44,7 @@ fn filesystem_switch_back_to_previous_working_directory() {
|
||||
r#"
|
||||
cd {}
|
||||
cd -
|
||||
pwd | echo $it
|
||||
echo $(pwd)
|
||||
"#,
|
||||
dirs.test()
|
||||
);
|
||||
@ -62,7 +62,7 @@ fn filesytem_change_from_current_directory_using_relative_path_and_dash() {
|
||||
cwd: dirs.test(),
|
||||
r#"
|
||||
cd odin/-
|
||||
pwd | echo $it
|
||||
echo $(pwd)
|
||||
"#
|
||||
);
|
||||
|
||||
@ -80,7 +80,7 @@ fn filesystem_change_current_directory_to_parent_directory() {
|
||||
cwd: dirs.test(),
|
||||
r#"
|
||||
cd ..
|
||||
pwd | echo $it
|
||||
echo $(pwd)
|
||||
"#
|
||||
);
|
||||
|
||||
@ -97,7 +97,7 @@ fn filesystem_change_current_directory_to_two_parents_up_using_multiple_dots() {
|
||||
cwd: dirs.test().join("foo/bar"),
|
||||
r#"
|
||||
cd ...
|
||||
pwd | echo $it
|
||||
echo $(pwd)
|
||||
"#
|
||||
);
|
||||
|
||||
@ -116,7 +116,7 @@ fn filesystem_change_current_directory_to_parent_directory_after_delete_cwd() {
|
||||
rm {}/foo/bar
|
||||
echo ","
|
||||
cd ..
|
||||
pwd | echo $it
|
||||
echo $(pwd)
|
||||
"#,
|
||||
dirs.test()
|
||||
);
|
||||
@ -135,7 +135,7 @@ fn filesystem_change_to_home_directory() {
|
||||
cwd: dirs.test(),
|
||||
r#"
|
||||
cd ~
|
||||
pwd | echo $it
|
||||
echo $(pwd)
|
||||
"#
|
||||
);
|
||||
|
||||
@ -152,7 +152,7 @@ fn filesystem_change_to_a_directory_containing_spaces() {
|
||||
cwd: dirs.test(),
|
||||
r#"
|
||||
cd "robalino turner katz"
|
||||
pwd | echo $it
|
||||
echo $(pwd)
|
||||
"#
|
||||
);
|
||||
|
||||
@ -219,7 +219,7 @@ fn filesystem_change_directory_to_symlink_relative() {
|
||||
cwd: dirs.test().join("boo"),
|
||||
r#"
|
||||
cd ../foo_link
|
||||
pwd | echo $it
|
||||
echo $(pwd)
|
||||
"#
|
||||
);
|
||||
|
||||
@ -249,7 +249,7 @@ fn valuesystem_change_from_current_path_using_relative_path() {
|
||||
r#"
|
||||
enter sample.toml
|
||||
cd bin
|
||||
pwd | echo $it
|
||||
pwd
|
||||
exit
|
||||
"#
|
||||
);
|
||||
@ -283,7 +283,7 @@ fn valuesystem_change_from_current_path_using_absolute_path() {
|
||||
enter sample.toml
|
||||
cd bin
|
||||
cd /dependencies
|
||||
pwd | echo $it
|
||||
pwd
|
||||
exit
|
||||
"#
|
||||
);
|
||||
@ -319,7 +319,7 @@ fn valuesystem_switch_back_to_previous_working_path() {
|
||||
cd dependencies
|
||||
cd /bin
|
||||
cd -
|
||||
pwd | echo $it
|
||||
pwd
|
||||
exit
|
||||
"#
|
||||
);
|
||||
@ -353,7 +353,7 @@ fn valuesystem_change_from_current_path_using_relative_path_and_dash() {
|
||||
cd package/-
|
||||
cd /bin
|
||||
cd -
|
||||
pwd | echo $it
|
||||
pwd
|
||||
exit
|
||||
"#
|
||||
);
|
||||
@ -380,7 +380,7 @@ fn valuesystem_change_current_path_to_parent_path() {
|
||||
enter sample.toml
|
||||
cd package/emberenios
|
||||
cd ..
|
||||
pwd | echo $it
|
||||
pwd
|
||||
exit
|
||||
"#
|
||||
);
|
||||
@ -405,7 +405,7 @@ fn valuesystem_change_to_a_path_containing_spaces() {
|
||||
r#"
|
||||
enter sample.toml
|
||||
cd "pa que te"
|
||||
pwd | echo $it
|
||||
pwd
|
||||
exit
|
||||
"#
|
||||
);
|
||||
|
@ -26,7 +26,6 @@ fn discards_rows_where_given_column_is_empty() {
|
||||
| get amigos
|
||||
| compact rusty_luck
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -43,7 +42,6 @@ fn discards_empty_rows_by_default() {
|
||||
| from json
|
||||
| compact
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -27,7 +27,6 @@ fn adds_row_data_if_column_missing() {
|
||||
| default rusty_luck 1
|
||||
| where rusty_luck == 1
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -4,7 +4,7 @@ use nu_test_support::{nu, pipeline};
|
||||
fn drop_rows() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
r#"echo '[{"foo": 3}, {"foo": 8}, {"foo": 4}]' | from json | drop 2 | get foo | math sum | echo $it"#
|
||||
r#"echo '[{"foo": 3}, {"foo": 8}, {"foo": 4}]' | from json | drop 2 | get foo | math sum "#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "3");
|
||||
|
@ -5,7 +5,7 @@ fn each_works_separately() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
echo [1 2 3] | each { echo $it 10 | math sum } | to json | echo $it
|
||||
echo [1 2 3] | each { echo $it 10 | math sum } | to json
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -5,7 +5,7 @@ fn echo_range_is_lazy() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
echo 1..10000000000 | first 3 | echo $it | to json
|
||||
echo 1..10000000000 | first 3 | to json
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -75,7 +75,7 @@ fn passing_a_block_will_set_contents_on_empty_cells_and_leave_non_empty_ones_unt
|
||||
]
|
||||
| empty? LVL { = 9 }
|
||||
| empty? HP {
|
||||
get LVL | = $it * 1000
|
||||
= $it.LVL * 1000
|
||||
}
|
||||
| math sum
|
||||
| get HP
|
||||
|
@ -18,7 +18,6 @@ fn gets_first_rows_by_amount() {
|
||||
ls
|
||||
| first 3
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -42,7 +41,6 @@ fn gets_all_rows_if_amount_higher_than_all_rows() {
|
||||
ls
|
||||
| first 99
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -61,7 +59,6 @@ fn gets_first_row_when_no_amount_given() {
|
||||
ls
|
||||
| first
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -10,7 +10,6 @@ fn creates_the_resulting_string_from_the_given_fields() {
|
||||
open cargo_sample.toml
|
||||
| get package
|
||||
| format "{name} has license {license}"
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -24,7 +23,6 @@ fn given_fields_can_be_column_paths() {
|
||||
r#"
|
||||
open cargo_sample.toml
|
||||
| format "{package.name} is {package.description}"
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -38,7 +36,6 @@ fn can_use_variables() {
|
||||
r#"
|
||||
open cargo_sample.toml
|
||||
| format "{$it.package.name} is {$it.package.description}"
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -17,7 +17,6 @@ fn fetches_a_row() {
|
||||
r#"
|
||||
open sample.toml
|
||||
| get nu_party_venue
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -44,7 +43,6 @@ fn fetches_by_index() {
|
||||
r#"
|
||||
open sample.toml
|
||||
| get package.authors.2
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -67,7 +65,6 @@ fn fetches_by_column_path() {
|
||||
r#"
|
||||
open sample.toml
|
||||
| get package.name
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -93,7 +90,6 @@ fn column_paths_are_either_double_quoted_or_regular_unquoted_words_separated_by_
|
||||
open sample.toml
|
||||
| get package."9999"
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -127,7 +123,6 @@ fn fetches_more_than_one_column_path() {
|
||||
open sample.toml
|
||||
| get fortune_tellers.2.name fortune_tellers.0.name fortune_tellers.1.name
|
||||
| nth 2
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -250,7 +245,7 @@ fn errors_fetching_by_index_out_of_bounds() {
|
||||
fn quoted_column_access() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
r#"echo '[{"foo bar": {"baz": 4}}]' | from json | get "foo bar".baz | echo $it"#
|
||||
r#"echo '[{"foo bar": {"baz": 4}}]' | from json | get "foo bar".baz "#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "4");
|
||||
|
@ -22,7 +22,6 @@ fn groups() {
|
||||
| group-by rusty_at
|
||||
| get "10/11/2013"
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -22,7 +22,6 @@ fn summarizes_by_column_given() {
|
||||
| histogram rusty_at countries
|
||||
| where rusty_at == "Ecuador"
|
||||
| get countries
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -55,7 +54,6 @@ fn summarizes_by_values() {
|
||||
| histogram
|
||||
| where value == "Estados Unidos"
|
||||
| get count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -8,7 +8,6 @@ fn sets_the_column_from_a_block_run_output() {
|
||||
open cargo_sample.toml
|
||||
| insert dev-dependencies.newdep "1"
|
||||
| get dev-dependencies.newdep
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -24,7 +23,6 @@ fn sets_the_column_from_a_block_full_stream_output() {
|
||||
| insert content { open --raw cargo_sample.toml | lines | first 5 }
|
||||
| get content.1
|
||||
| str contains "nu"
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -40,7 +38,6 @@ fn sets_the_column_from_an_invocation() {
|
||||
| insert content $(open --raw cargo_sample.toml | lines | first 5)
|
||||
| get content.1
|
||||
| str contains "nu"
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -5,7 +5,7 @@ fn into_int_filesize() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
into-int 1kb | = $it / 1024
|
||||
into-int 1kb | each {= $it / 1024 }
|
||||
"#
|
||||
));
|
||||
|
||||
@ -17,7 +17,7 @@ fn into_int_int() {
|
||||
let actual = nu!(
|
||||
cwd: ".", pipeline(
|
||||
r#"
|
||||
into-int 1024 | = $it / 1024
|
||||
into-int 1024 | each {= $it / 1024 }
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -23,7 +23,6 @@ fn rows() {
|
||||
| keep 3
|
||||
| get lucky_code
|
||||
| math sum
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -43,7 +43,6 @@ fn condition_is_met() {
|
||||
| str to-int "31/04/2020"
|
||||
| get "31/04/2020"
|
||||
| math sum
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -42,7 +42,6 @@ fn condition_is_met() {
|
||||
| str to-int "31/04/2020"
|
||||
| get "31/04/2020"
|
||||
| math sum
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -6,7 +6,7 @@ use nu_test_support::{nu, pipeline};
|
||||
fn gets_the_last_row() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
"ls | sort-by name | last 1 | get name | str trim | echo $it"
|
||||
"ls | sort-by name | last 1 | get name | str trim"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "utf16.ini");
|
||||
@ -28,7 +28,6 @@ fn gets_last_rows_by_amount() {
|
||||
ls
|
||||
| last 3
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -47,7 +46,6 @@ fn gets_last_row_when_no_amount_given() {
|
||||
ls
|
||||
| last
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -13,7 +13,6 @@ fn lines() {
|
||||
| split column "="
|
||||
| get Column1
|
||||
| str trim
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -16,7 +16,6 @@ fn lists_regular_files() {
|
||||
r#"
|
||||
ls
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -39,7 +38,6 @@ fn lists_regular_files_using_asterisk_wildcard() {
|
||||
r#"
|
||||
ls *.txt
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -62,7 +60,6 @@ fn lists_regular_files_using_question_mark_wildcard() {
|
||||
r#"
|
||||
ls *.??.txt
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -90,9 +87,8 @@ fn lists_all_files_in_directories_from_stream() {
|
||||
cwd: dirs.test(), pipeline(
|
||||
r#"
|
||||
echo dir_a dir_b
|
||||
| ls $it
|
||||
| each { ls $it }
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -110,7 +106,6 @@ fn does_not_fail_if_glob_matches_empty_directory() {
|
||||
r#"
|
||||
ls dir_a
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -147,7 +142,7 @@ fn list_files_from_two_parents_up_using_multiple_dots() {
|
||||
let actual = nu!(
|
||||
cwd: dirs.test().join("foo/bar"),
|
||||
r#"
|
||||
ls ... | count | echo $it
|
||||
ls ... | count
|
||||
"#
|
||||
);
|
||||
|
||||
@ -171,7 +166,6 @@ fn lists_hidden_file_when_explicitly_specified() {
|
||||
r#"
|
||||
ls .testdotfile
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -206,7 +200,6 @@ fn lists_all_hidden_files_when_glob_contains_dot() {
|
||||
r#"
|
||||
ls **/.*
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -244,7 +237,6 @@ fn lists_all_hidden_files_when_glob_does_not_contain_dot() {
|
||||
r#"
|
||||
ls **/*
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -268,7 +260,6 @@ fn lists_files_including_starting_with_dot() {
|
||||
r#"
|
||||
ls -a
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -8,7 +8,6 @@ fn can_average_numbers() {
|
||||
open sgml_description.json
|
||||
| get glossary.GlossDiv.GlossList.GlossEntry.Sections
|
||||
| math avg
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -19,7 +18,7 @@ fn can_average_numbers() {
|
||||
fn can_average_bytes() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
"ls | sort-by name | skip 1 | first 2 | get size | math avg | format \"{$it}\" | echo $it"
|
||||
"ls | sort-by name | skip 1 | first 2 | get size | math avg | format \"{$it}\" "
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "1.6 KB");
|
||||
|
@ -7,7 +7,6 @@ fn median_numbers_with_even_rows() {
|
||||
r#"
|
||||
echo [10 6 19 21 4]
|
||||
| math median
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -21,7 +20,6 @@ fn median_numbers_with_odd_rows() {
|
||||
r#"
|
||||
echo [3 8 9 12 12 15]
|
||||
| math median
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -35,7 +33,6 @@ fn median_mixed_numbers() {
|
||||
r#"
|
||||
echo [-11.5 -13.5 10]
|
||||
| math median
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -209,18 +209,6 @@ fn duration_math_with_negative() {
|
||||
assert_eq!(actual.out, "-6day");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn it_math() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
echo 1020 | = $it + 10
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "1030");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn compound_comparison() {
|
||||
let actual = nu!(
|
||||
|
@ -26,7 +26,6 @@ fn all() {
|
||||
| get meals
|
||||
| get calories
|
||||
| math sum
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -36,7 +35,7 @@ fn all() {
|
||||
|
||||
#[test]
|
||||
fn outputs_zero_with_no_input() {
|
||||
let actual = nu!(cwd: ".", "math sum | echo $it");
|
||||
let actual = nu!(cwd: ".", "math sum");
|
||||
|
||||
assert_eq!(actual.out, "0");
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ fn row() {
|
||||
| where country in ["Guayaquil Ecuador" "New Zealand"]
|
||||
| get luck
|
||||
| math sum
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -71,7 +71,6 @@ fn show_created_paths() {
|
||||
r#"
|
||||
mkdir -s dir_1 dir_2 dir_3
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -27,7 +27,6 @@ fn moves_a_column_before() {
|
||||
| get chars
|
||||
| str trim
|
||||
| str collect
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -62,7 +61,6 @@ fn moves_columns_before() {
|
||||
| get chars_2 chars_1
|
||||
| str trim
|
||||
| str collect
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -98,7 +96,6 @@ fn moves_a_column_after() {
|
||||
| get chars_1 chars_2
|
||||
| str trim
|
||||
| str collect
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -132,7 +129,6 @@ fn moves_columns_after() {
|
||||
| get
|
||||
| nth 1 2
|
||||
| str collect
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -10,7 +10,6 @@ fn selects_a_row() {
|
||||
| sort-by name
|
||||
| nth 0
|
||||
| get name
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -30,10 +29,9 @@ fn selects_many_rows() {
|
||||
| get name
|
||||
| nth 1 0
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "2");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ fn parses_csv() {
|
||||
open nu.zion.csv
|
||||
| where author == "Andres N. Robalino"
|
||||
| get source
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -59,7 +58,7 @@ fn parses_csv() {
|
||||
fn parses_bson() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
"open sample.bson | get root | nth 0 | get b | echo $it"
|
||||
"open sample.bson | get root | nth 0 | get b"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "hello");
|
||||
@ -76,7 +75,6 @@ fn parses_more_bson_complexity() {
|
||||
| nth 6
|
||||
| get b
|
||||
| get '$binary_subtype'
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -142,7 +140,6 @@ fn parses_sqlite() {
|
||||
| get table_values
|
||||
| nth 2
|
||||
| get x
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -153,7 +150,7 @@ fn parses_sqlite() {
|
||||
fn parses_toml() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
"open cargo_sample.toml | get package.edition | echo $it"
|
||||
"open cargo_sample.toml | get package.edition"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "2018");
|
||||
@ -167,7 +164,6 @@ fn parses_tsv() {
|
||||
open caco3_plastics.tsv
|
||||
| first 1
|
||||
| get origin
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -181,7 +177,6 @@ fn parses_json() {
|
||||
r#"
|
||||
open sgml_description.json
|
||||
| get glossary.GlossDiv.GlossList.GlossEntry.GlossSee
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -192,7 +187,7 @@ fn parses_json() {
|
||||
fn parses_xml() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
"open jonathan.xml | get rss.children.channel.children | get item.children | get link.children | echo $it"
|
||||
"open jonathan.xml | get rss.children.channel.children | get item.children | get link.children.0"
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
@ -205,7 +200,7 @@ fn parses_xml() {
|
||||
fn parses_ini() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
"open sample.ini | get SectionOne.integer | echo $it"
|
||||
"open sample.ini | get SectionOne.integer"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "1234")
|
||||
@ -215,7 +210,7 @@ fn parses_ini() {
|
||||
fn parses_utf16_ini() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
"open utf16.ini | get '.ShellClassInfo' | get IconIndex | echo $it"
|
||||
"open utf16.ini | get '.ShellClassInfo' | get IconIndex"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "-236")
|
||||
|
@ -24,7 +24,7 @@ mod simple {
|
||||
| lines
|
||||
| each { echo $it | parse "{Name}={Value}" }
|
||||
| nth 1
|
||||
| echo $it.Value
|
||||
| get Value
|
||||
"#
|
||||
));
|
||||
|
||||
@ -40,7 +40,7 @@ mod simple {
|
||||
r#"
|
||||
echo "{abc}123"
|
||||
| parse "{{abc}{name}"
|
||||
| echo $it.name
|
||||
| get name
|
||||
"#
|
||||
));
|
||||
|
||||
@ -56,7 +56,7 @@ mod simple {
|
||||
r#"
|
||||
echo "(abc)123"
|
||||
| parse "(abc){name}"
|
||||
| echo $it.name
|
||||
| get name
|
||||
"#
|
||||
));
|
||||
|
||||
@ -89,7 +89,7 @@ mod simple {
|
||||
r#"
|
||||
echo "(abc)123"
|
||||
| parse "(abc){name"
|
||||
| echo $it.name
|
||||
| get name
|
||||
"#
|
||||
));
|
||||
|
||||
@ -123,7 +123,6 @@ mod regex {
|
||||
| parse --regex "(?P<Hash>\w+) (?P<Message>.+) \(#(?P<PR>\d+)\)"
|
||||
| nth 1
|
||||
| get PR
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -143,7 +142,6 @@ mod regex {
|
||||
| parse --regex "(\w+) (.+) \(#(\d+)\)"
|
||||
| nth 1
|
||||
| get Capture1
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -163,7 +161,6 @@ mod regex {
|
||||
| parse --regex "(?P<Hash>\w+) (.+) \(#(?P<PR>\d+)\)"
|
||||
| nth 1
|
||||
| get Capture2
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -181,7 +178,6 @@ mod regex {
|
||||
r#"
|
||||
open nushell_git_log_oneline.txt
|
||||
| parse --regex "(?P<Hash>\w+ unfinished capture group"
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -21,7 +21,6 @@ fn adds_a_row_to_the_beginning() {
|
||||
| lines
|
||||
| prepend "pollo loco"
|
||||
| nth 0
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -14,7 +14,6 @@ fn selects_a_row() {
|
||||
| sort-by name
|
||||
| range 0..0
|
||||
| get name
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -38,7 +37,6 @@ fn selects_some_rows() {
|
||||
| get name
|
||||
| range 1..2
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -54,7 +54,6 @@ fn reduce_numbered_example() {
|
||||
echo one longest three bar
|
||||
| reduce -n { if $(echo $it.item | str length) > $(echo $acc.item | str length) {echo $it} {echo $acc}}
|
||||
| get index
|
||||
| echo $it
|
||||
"#
|
||||
)
|
||||
);
|
||||
@ -74,7 +73,6 @@ fn folding_with_tables() {
|
||||
}
|
||||
}
|
||||
| math sum
|
||||
| echo $it
|
||||
"#
|
||||
)
|
||||
);
|
||||
|
@ -24,7 +24,6 @@ fn changes_the_column_name() {
|
||||
| rename mosqueteros
|
||||
| get mosqueteros
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -55,7 +54,6 @@ fn keeps_remaining_original_names_given_less_new_names_than_total_original_names
|
||||
| rename mosqueteros
|
||||
| get hit
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -4,7 +4,7 @@ use nu_test_support::nu;
|
||||
fn can_get_reverse_first() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
"ls | sort-by name | reverse | first 1 | get name | str trim | echo $it"
|
||||
"ls | sort-by name | reverse | first 1 | get name | str trim "
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "utf16.ini");
|
||||
|
@ -22,7 +22,6 @@ fn regular_columns() {
|
||||
| select rusty_at last_name
|
||||
| nth 0
|
||||
| get last_name
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -65,7 +64,6 @@ fn complex_nested_columns() {
|
||||
| select nu."0xATYKARNU" nu.committers.name nu.releases.version
|
||||
| where "nu.releases.version" > "0.8"
|
||||
| get "nu.releases.version"
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -92,7 +90,6 @@ fn allows_if_given_unknown_column_name_is_missing() {
|
||||
open los_tres_caballeros.csv
|
||||
| select rrusty_at first_name
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -42,7 +42,6 @@ fn condition_is_met() {
|
||||
| str to-int "31/04/2020"
|
||||
| get "31/04/2020"
|
||||
| math sum
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -42,7 +42,6 @@ fn condition_is_met() {
|
||||
| str to-int "31/04/2020"
|
||||
| get "31/04/2020"
|
||||
| math sum
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -15,7 +15,6 @@ fn by_column() {
|
||||
| first 1
|
||||
| get Column1
|
||||
| str trim
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -37,7 +36,6 @@ fn by_invalid_column() {
|
||||
| first 1
|
||||
| get Column1
|
||||
| str trim
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -73,7 +71,6 @@ fn sort_primitive_values() {
|
||||
| first 6
|
||||
| sort-by
|
||||
| first 1
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -23,7 +23,6 @@ fn splits() {
|
||||
| split-by type
|
||||
| get A."10/11/2013"
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -20,7 +20,6 @@ fn to_column() {
|
||||
| str trim
|
||||
| split column ","
|
||||
| get Column2
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -20,7 +20,6 @@ fn to_row() {
|
||||
| str trim
|
||||
| split row ","
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -17,7 +17,7 @@ fn trims() {
|
||||
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(),
|
||||
"open sample.toml | str trim dependency.name | get dependency.name | echo $it"
|
||||
"open sample.toml | str trim dependency.name | get dependency.name"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "nu");
|
||||
@ -50,7 +50,7 @@ fn capitalizes() {
|
||||
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(),
|
||||
"open sample.toml | str capitalize dependency.name | get dependency.name | echo $it"
|
||||
"open sample.toml | str capitalize dependency.name | get dependency.name"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "Nu");
|
||||
@ -70,7 +70,7 @@ fn downcases() {
|
||||
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(),
|
||||
"open sample.toml | str downcase dependency.name | get dependency.name | echo $it"
|
||||
"open sample.toml | str downcase dependency.name | get dependency.name"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "light");
|
||||
@ -90,7 +90,7 @@ fn upcases() {
|
||||
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(),
|
||||
"open sample.toml | str upcase package.name | get package.name | echo $it"
|
||||
"open sample.toml | str upcase package.name | get package.name"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "NUSHELL");
|
||||
@ -110,7 +110,7 @@ fn camelcases() {
|
||||
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(),
|
||||
"open sample.toml | str camel-case dependency.name | get dependency.name | echo $it"
|
||||
"open sample.toml | str camel-case dependency.name | get dependency.name"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "thisIsATest");
|
||||
@ -128,7 +128,7 @@ fn converts_to_int() {
|
||||
| rename number
|
||||
| where number == 1
|
||||
| get number
|
||||
| echo $it
|
||||
|
||||
"#
|
||||
));
|
||||
|
||||
@ -167,7 +167,6 @@ fn sets() {
|
||||
open sample.toml
|
||||
| str set wykittenshell package.name
|
||||
| get package.name
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -192,7 +191,6 @@ fn find_and_replaces() {
|
||||
open sample.toml
|
||||
| str find-replace KATZ "5289" fortune.teller.phone
|
||||
| get fortune.teller.phone
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -217,7 +215,6 @@ fn find_and_replaces_without_passing_field() {
|
||||
open sample.toml
|
||||
| get fortune.teller.phone
|
||||
| str find-replace KATZ "5289"
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -242,7 +239,6 @@ fn substrings_the_input() {
|
||||
open sample.toml
|
||||
| str substring 6,14 fortune.teller.phone
|
||||
| get fortune.teller.phone
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -266,7 +262,6 @@ fn substring_errors_if_start_index_is_greater_than_end_index() {
|
||||
r#"
|
||||
open sample.toml
|
||||
| str substring 6,5 fortune.teller.phone
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -293,7 +288,6 @@ fn substrings_the_input_and_returns_the_string_if_end_index_exceeds_length() {
|
||||
open sample.toml
|
||||
| str substring 0,999 package.name
|
||||
| get package.name
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -318,7 +312,6 @@ fn substrings_the_input_and_returns_blank_if_start_index_exceeds_length() {
|
||||
open sample.toml
|
||||
| str substring 50,999 package.name
|
||||
| get package.name
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -343,7 +336,6 @@ fn substrings_the_input_and_treats_start_index_as_zero_if_blank_start_index_give
|
||||
open sample.toml
|
||||
| str substring ,2 package.name
|
||||
| get package.name
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -368,7 +360,6 @@ fn substrings_the_input_and_treats_end_index_as_length_if_blank_end_index_given(
|
||||
open sample.toml
|
||||
| str substring 3, package.name
|
||||
| get package.name
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -23,7 +23,7 @@ fn removes_duplicate_rows() {
|
||||
open los_tres_caballeros.csv
|
||||
| uniq
|
||||
| count
|
||||
| echo $it
|
||||
|
||||
"#
|
||||
));
|
||||
|
||||
@ -53,7 +53,7 @@ fn uniq_values() {
|
||||
| select type
|
||||
| uniq
|
||||
| count
|
||||
| echo $it
|
||||
|
||||
"#
|
||||
));
|
||||
|
||||
@ -118,7 +118,7 @@ fn nested_json_structures() {
|
||||
open nested_json_structures.json
|
||||
| uniq
|
||||
| count
|
||||
| echo $it
|
||||
|
||||
"#
|
||||
));
|
||||
assert_eq!(actual.out, "3");
|
||||
@ -134,7 +134,7 @@ fn uniq_when_keys_out_of_order() {
|
||||
| from json
|
||||
| uniq
|
||||
| count
|
||||
| echo $it
|
||||
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -8,7 +8,6 @@ fn sets_the_column() {
|
||||
open cargo_sample.toml
|
||||
| update dev-dependencies.pretty_assertions "0.7.0"
|
||||
| get dev-dependencies.pretty_assertions
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -24,7 +23,6 @@ fn sets_the_column_from_a_block_run_output() {
|
||||
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
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -40,7 +38,6 @@ fn sets_the_column_from_a_block_full_stream_output() {
|
||||
| update content { open --raw cargo_sample.toml | lines | first 5 }
|
||||
| get content.1
|
||||
| str contains "nu"
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -56,7 +53,6 @@ fn sets_the_column_from_an_invocation() {
|
||||
| update content $(open --raw cargo_sample.toml | lines | first 5)
|
||||
| get content.1
|
||||
| str contains "nu"
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -7,7 +7,7 @@ use nu_test_support::pipeline;
|
||||
fn filters_by_unit_size_comparison() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
"ls | where size > 1kb | sort-by size | get name | first 1 | str trim | echo $it"
|
||||
"ls | where size > 1kb | sort-by size | get name | first 1 | str trim"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "cargo_sample.toml");
|
||||
@ -17,7 +17,7 @@ fn filters_by_unit_size_comparison() {
|
||||
fn filters_with_nothing_comparison() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
r#"echo '[{"foo": 3}, {"foo": null}, {"foo": 4}]' | from json | get foo | compact | where $it > 1 | math sum | echo $it"#
|
||||
r#"echo '[{"foo": 3}, {"foo": null}, {"foo": 4}]' | from json | get foo | compact | where $it > 1 | math sum"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "7");
|
||||
@ -27,7 +27,7 @@ fn filters_with_nothing_comparison() {
|
||||
fn where_in_table() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
r#"echo '[{"name": "foo", "size": 3}, {"name": "foo", "size": 2}, {"name": "bar", "size": 4}]' | from json | where name in ["foo"] | get size | math sum | echo $it"#
|
||||
r#"echo '[{"name": "foo", "size": 3}, {"name": "foo", "size": 2}, {"name": "bar", "size": 4}]' | from json | where name in ["foo"] | get size | math sum"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "5");
|
||||
@ -37,7 +37,7 @@ fn where_in_table() {
|
||||
fn where_not_in_table() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
r#"echo '[{"name": "foo", "size": 3}, {"name": "foo", "size": 2}, {"name": "bar", "size": 4}]' | from json | where name not-in ["foo"] | get size | math sum | echo $it"#
|
||||
r#"echo '[{"name": "foo", "size": 3}, {"name": "foo", "size": 2}, {"name": "bar", "size": 4}]' | from json | where name not-in ["foo"] | get size | math sum"#
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "4");
|
||||
@ -55,7 +55,6 @@ fn explicit_block_condition() {
|
||||
| first 4
|
||||
| where {= $it.z > 4200}
|
||||
| get z
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -74,7 +73,6 @@ fn binary_operator_comparisons() {
|
||||
| first 4
|
||||
| where z > 4200
|
||||
| get z
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -89,7 +87,6 @@ fn binary_operator_comparisons() {
|
||||
| first 4
|
||||
| where z >= 4253
|
||||
| get z
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -104,7 +101,6 @@ fn binary_operator_comparisons() {
|
||||
| first 4
|
||||
| where z < 10
|
||||
| get z
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -119,7 +115,6 @@ fn binary_operator_comparisons() {
|
||||
| first 4
|
||||
| where z <= 1
|
||||
| get z
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -134,7 +129,6 @@ fn binary_operator_comparisons() {
|
||||
| where z != 1
|
||||
| first 1
|
||||
| get z
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -152,7 +146,6 @@ fn contains_operator() {
|
||||
| get table_values
|
||||
| where x =~ ell
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -166,7 +159,6 @@ fn contains_operator() {
|
||||
| get table_values
|
||||
| where x !~ ell
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
@ -24,7 +24,6 @@ fn wrap_rows_into_a_row() {
|
||||
| get caballeros
|
||||
| nth 0
|
||||
| get last_name
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
@ -54,7 +53,6 @@ fn wrap_rows_into_a_table() {
|
||||
| wrap caballero
|
||||
| nth 2
|
||||
| get caballero
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
|
Reference in New Issue
Block a user