Skip to content

Commit

Permalink
test_sort: Preserve the environment variable when executing tests (#3031
Browse files Browse the repository at this point in the history
)

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

Signed-off-by: Hanif Bin Ariffin <[email protected]>

* Fix the test by saving the environment variable

Signed-off-by: Hanif Bin Ariffin <[email protected]>

Co-authored-by: Hanif Bin Ariffin <[email protected]>
  • Loading branch information
hbina and Hanif Bin Ariffin authored Feb 3, 2022
1 parent 2d3b8db commit e60b581
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/by-util/test_sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit e60b581

Please sign in to comment.