mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge pull request #2333 from tertsdiepraam/pr/fix-current-time-test
`pr`: fix usage of current time in tests
This commit is contained in:
commit
eb6e6d49eb
1 changed files with 10 additions and 5 deletions
|
@ -288,13 +288,14 @@ fn test_with_suppress_error_option() {
|
||||||
fn test_with_stdin() {
|
fn test_with_stdin() {
|
||||||
let expected_file_path = "stdin.log.expected";
|
let expected_file_path = "stdin.log.expected";
|
||||||
let mut scenario = new_ucmd!();
|
let mut scenario = new_ucmd!();
|
||||||
|
let now = now_time();
|
||||||
scenario
|
scenario
|
||||||
.pipe_in_fixture("stdin.log")
|
.pipe_in_fixture("stdin.log")
|
||||||
.args(&["--pages=1:2", "-n", "-"])
|
.args(&["--pages=1:2", "-n", "-"])
|
||||||
.run()
|
.run()
|
||||||
.stdout_is_templated_fixture(
|
.stdout_is_templated_fixture(
|
||||||
expected_file_path,
|
expected_file_path,
|
||||||
vec![(&"{last_modified_time}".to_string(), &now_time())],
|
vec![(&"{last_modified_time}".to_string(), &now)],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,22 +382,25 @@ fn test_with_mpr() {
|
||||||
let expected_test_file_path = "mpr.log.expected";
|
let expected_test_file_path = "mpr.log.expected";
|
||||||
let expected_test_file_path1 = "mpr1.log.expected";
|
let expected_test_file_path1 = "mpr1.log.expected";
|
||||||
let expected_test_file_path2 = "mpr2.log.expected";
|
let expected_test_file_path2 = "mpr2.log.expected";
|
||||||
|
let now = now_time();
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&["--pages=1:2", "-m", "-n", test_file_path, test_file_path1])
|
.args(&["--pages=1:2", "-m", "-n", test_file_path, test_file_path1])
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_is_templated_fixture(
|
.stdout_is_templated_fixture(
|
||||||
expected_test_file_path,
|
expected_test_file_path,
|
||||||
vec![(&"{last_modified_time}".to_string(), &now_time())],
|
vec![(&"{last_modified_time}".to_string(), &now)],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let now = now_time();
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&["--pages=2:4", "-m", "-n", test_file_path, test_file_path1])
|
.args(&["--pages=2:4", "-m", "-n", test_file_path, test_file_path1])
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_is_templated_fixture(
|
.stdout_is_templated_fixture(
|
||||||
expected_test_file_path1,
|
expected_test_file_path1,
|
||||||
vec![(&"{last_modified_time}".to_string(), &now_time())],
|
vec![(&"{last_modified_time}".to_string(), &now)],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let now = now_time();
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.args(&[
|
.args(&[
|
||||||
"--pages=1:2",
|
"--pages=1:2",
|
||||||
|
@ -411,7 +415,7 @@ fn test_with_mpr() {
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_is_templated_fixture(
|
.stdout_is_templated_fixture(
|
||||||
expected_test_file_path2,
|
expected_test_file_path2,
|
||||||
vec![(&"{last_modified_time}".to_string(), &now_time())],
|
vec![(&"{last_modified_time}".to_string(), &now)],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,11 +511,12 @@ fn test_with_join_lines_option() {
|
||||||
let test_file_2 = "test.log";
|
let test_file_2 = "test.log";
|
||||||
let expected_file_path = "joined.log.expected";
|
let expected_file_path = "joined.log.expected";
|
||||||
let mut scenario = new_ucmd!();
|
let mut scenario = new_ucmd!();
|
||||||
|
let now = now_time();
|
||||||
scenario
|
scenario
|
||||||
.args(&["+1:2", "-J", "-m", test_file_1, test_file_2])
|
.args(&["+1:2", "-J", "-m", test_file_1, test_file_2])
|
||||||
.run()
|
.run()
|
||||||
.stdout_is_templated_fixture(
|
.stdout_is_templated_fixture(
|
||||||
expected_file_path,
|
expected_file_path,
|
||||||
vec![(&"{last_modified_time}".to_string(), &now_time())],
|
vec![(&"{last_modified_time}".to_string(), &now)],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue