1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-16 03:36:18 +00:00

Merge pull request #3667 from cakebaker/set_default_missing_value

uniq: set default missing value for "group" and "all-repeated" args
This commit is contained in:
Sylvestre Ledru 2022-07-01 00:01:21 +02:00 committed by GitHub
commit f6a88552ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 1 deletions

View file

@ -1,3 +1,5 @@
use std::io::Write;
// spell-checker:ignore nabcd
use crate::common::util::*;
@ -86,6 +88,20 @@ fn test_stdin_all_repeated() {
.stdout_is_fixture("sorted-all-repeated.expected");
}
#[test]
fn test_all_repeated_followed_by_filename() {
let filename = "test.txt";
let (at, mut ucmd) = at_and_ucmd!();
let mut file = at.make_file(filename);
file.write_all(b"a\na\n").unwrap();
ucmd.args(&["--all-repeated", filename])
.run()
.success()
.stdout_is("a\na\n");
}
#[test]
fn test_stdin_all_repeated_separate() {
new_ucmd!()
@ -160,6 +176,20 @@ fn test_group() {
.stdout_is_fixture("group.expected");
}
#[test]
fn test_group_followed_by_filename() {
let filename = "test.txt";
let (at, mut ucmd) = at_and_ucmd!();
let mut file = at.make_file(filename);
file.write_all(b"a\na\n").unwrap();
ucmd.args(&["--group", filename])
.run()
.success()
.stdout_is("a\na\n");
}
#[test]
fn test_group_prepend() {
new_ucmd!()