mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Drop with iter range (#4242)
* Allow range in 'drop nth' * Unit tests for drop nth range * Add range case to the description * Fix description 2 * format fixes * Fix example and some refactoring * clippy fixes
This commit is contained in:
@ -66,3 +66,25 @@ fn more_rows_than_table_has() {
|
||||
|
||||
assert_eq!(actual.out, "0");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nth_range_inclusive() {
|
||||
let actual = nu!(cwd: ".", "echo 10..15 | drop nth (2..3) | to json");
|
||||
|
||||
assert_eq!(actual.out, "[10,11,14,15]");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nth_range_exclusive() {
|
||||
let actual = nu!(cwd: ".", "echo 10..15 | drop nth (1..<3) | to json");
|
||||
|
||||
assert_eq!(actual.out, "[10,13,14,15]");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nth_missing_first_argument() {
|
||||
let actual = nu!(cwd: ".", "echo 10..15 | drop nth \"\"");
|
||||
|
||||
assert!(actual.err.contains("Expected int or range"));
|
||||
assert!(actual.err.contains("found string"));
|
||||
}
|
||||
|
Reference in New Issue
Block a user