make take behave like first (#6893)

* fix take_1 behavior

* fix test case

* simplify code

* reverse back for first command

* fix example

* make arg required

* add test

* fix test message
This commit is contained in:
WindSoilder
2022-11-09 18:32:16 +08:00
committed by GitHub
parent 6cc4ef6c70
commit 85587c0c2a
2 changed files with 24 additions and 22 deletions

View File

@ -29,3 +29,15 @@ fn rows() {
assert_eq!(actual.out, "4");
})
}
#[test]
fn rows_with_no_arguments_should_lead_to_error() {
Playground::setup("take_test_2", |dirs, _sandbox| {
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"[1 2 3] | take"#
));
assert!(actual.err.contains("missing_positional"));
})
}