make first behave same way as last: always return list when with number argument (#6616)

* make `first` behave same way as `last`

* better behaviour

* fix tests

* add tests
This commit is contained in:
pwygab
2022-09-29 06:08:17 +08:00
committed by GitHub
parent dd578926c3
commit 32fbcf39cc
12 changed files with 44 additions and 16 deletions

View File

@@ -7,7 +7,7 @@ fn chooses_highest_increment_if_given_more_than_one() {
let actual = nu_with_plugins!(
cwd: "tests/fixtures/formats",
plugin: ("nu_plugin_inc"),
"open cargo_sample.toml | first 1 | inc package.version --major --minor | get package.version"
"open cargo_sample.toml | first | inc package.version --major --minor | get package.version"
);
assert_eq!(actual.out, "1.0.0");
@@ -16,7 +16,7 @@ fn chooses_highest_increment_if_given_more_than_one() {
cwd: "tests/fixtures/formats",
plugin: ("nu_plugin_inc"),
// Regardless of order of arguments
"open cargo_sample.toml | first 1 | inc package.version --minor --major | get package.version"
"open cargo_sample.toml | first | inc package.version --minor --major | get package.version"
);
assert_eq!(actual.out, "1.0.0");