#3385: Add unique option for uniq command (#3754)

* Added -u arg for command uniq.

* Update uniq.rs

Co-authored-by: JT <jonathandturner@users.noreply.github.com>
This commit is contained in:
Matheus
2021-07-09 16:27:35 -03:00
committed by GitHub
parent 11cb5ed10e
commit 5bc7a1f435
2 changed files with 34 additions and 3 deletions

View File

@ -170,6 +170,26 @@ fn uniq_counting() {
assert_eq!(actual.out, "1");
}
#[test]
fn uniq_unique() {
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
r#"
echo [1 2 3 4 1 5]
| uniq --unique
"#
));
let expected = nu!(
cwd: "tests/fixtures/formats", pipeline(
r#"
echo [2 3 4 5]
"#
));
print!("{}", actual.out);
print!("{}", expected.out);
assert_eq!(actual.out, expected.out);
}
#[test]
fn uniq_simple_vals_ints() {
let actual = nu!(