-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
tests/printenv: add more tests #9151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
GNU testsuite comparison: |
tests/by-util/test_printenv.rs
Outdated
| .stdout_contains("VALUE\n") | ||
| .stdout_does_not_contain("BAR"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's clearer if you simply check for the exact expected output:
| .stdout_contains("VALUE\n") | |
| .stdout_does_not_contain("BAR"); | |
| .stdout_is("VALUE\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it
tests/by-util/test_printenv.rs
Outdated
| .stdout_contains("VALUE\n") | ||
| .stdout_does_not_contain("c"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. In addition, I would also ensure that it is a silent error.
| .stdout_contains("VALUE\n") | |
| .stdout_does_not_contain("c"); | |
| .stdout_is("VALUE\n") | |
| .no_stderr(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it
tests/by-util/test_printenv.rs
Outdated
| .arg("FOO") | ||
| .arg("KEY") | ||
| .fails_with_code(1) | ||
| .stdout_contains("VALUE\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
| .stdout_contains("VALUE\n"); | |
| .stdout_is("VALUE\n") | |
| .no_stderr(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
tests/by-util/test_printenv.rs
Outdated
| .stdout_contains("FOO\x00") | ||
| .stdout_contains("VALUE\x00") | ||
| .stdout_does_not_contain("BAR"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I would check for the exact output:
| .stdout_contains("FOO\x00") | |
| .stdout_contains("VALUE\x00") | |
| .stdout_does_not_contain("BAR"); | |
| .stdout_is("FOO\x00VALUE\x00"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
tests/by-util/test_printenv.rs
Outdated
| new_ucmd!() | ||
| .env("HOME", "FOO") | ||
| .env("KEY", "VALUE") | ||
| .arg("-0") | ||
| .succeeds() | ||
| .stdout_contains("HOME=FOO\x00") | ||
| .stdout_contains("KEY=VALUE\x00"); | ||
|
|
||
| new_ucmd!() | ||
| .env("HOME", "FOO") | ||
| .env("KEY", "VALUE") | ||
| .arg("--null") | ||
| .succeeds() | ||
| .stdout_contains("HOME=FOO\x00") | ||
| .stdout_contains("KEY=VALUE\x00"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it might make sense to use a loop over the args so it's easy to see that -0 and --null are the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. I wrapped it with a loop of ["-0", "--null"]. Thanks for the review
|
Some tests failed due to some Fedora-related issue. It doesn’t seem to be related to my code. |
Yes, that's unrelated. Thanks for your PR! |
* tests/printenv: add more tests * tests/printenv: use clearer checks in tests
Added a few missing tests for the
printenvutility.No code changes, only test additions