1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

test_sort: Preserve the environment variable when executing tests (#3031)

* test_sort: Output sorted files to a file with different name

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.43262@gmail.com>

* Fix the test by saving the environment variable

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.43262@gmail.com>

Co-authored-by: Hanif Bin Ariffin <hanif.ariffin.43262@gmail.com>
This commit is contained in:
Hanif Ariffin 2022-02-03 23:02:50 +08:00 committed by GitHub
parent 2d3b8db9ed
commit e60b581c38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1066,10 +1066,13 @@ fn test_separator_null() {
#[test]
fn test_output_is_input() {
let input = "a\nb\nc\n";
let (at, mut cmd) = at_and_ucmd!();
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.touch("file");
at.append("file", input);
cmd.args(&["-m", "-u", "-o", "file", "file", "file", "file"])
scene
.ucmd_keepenv()
.args(&["-m", "-u", "-o", "file", "file", "file", "file"])
.succeeds();
assert_eq!(at.read("file"), input);
}