Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ya7on
Copy link
Contributor

@ya7on ya7on commented Nov 5, 2025

Added a few missing tests for the printenv utility.
No code changes, only test additions

@github-actions
Copy link

github-actions bot commented Nov 6, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/tail/overlay-headers (fails in this run but passes in the 'main' branch)

Comment on lines 24 to 25
.stdout_contains("VALUE\n")
.stdout_does_not_contain("BAR");
Copy link
Contributor

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:

Suggested change
.stdout_contains("VALUE\n")
.stdout_does_not_contain("BAR");
.stdout_is("VALUE\n");

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it

Comment on lines 43 to 44
.stdout_contains("VALUE\n")
.stdout_does_not_contain("c");
Copy link
Contributor

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.

Suggested change
.stdout_contains("VALUE\n")
.stdout_does_not_contain("c");
.stdout_is("VALUE\n")
.no_stderr();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it

.arg("FOO")
.arg("KEY")
.fails_with_code(1)
.stdout_contains("VALUE\n");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Suggested change
.stdout_contains("VALUE\n");
.stdout_is("VALUE\n")
.no_stderr();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment on lines 97 to 99
.stdout_contains("FOO\x00")
.stdout_contains("VALUE\x00")
.stdout_does_not_contain("BAR");
Copy link
Contributor

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:

Suggested change
.stdout_contains("FOO\x00")
.stdout_contains("VALUE\x00")
.stdout_does_not_contain("BAR");
.stdout_is("FOO\x00VALUE\x00");

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment on lines 73 to 87
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");
Copy link
Contributor

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.

Copy link
Contributor Author

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

@ya7on ya7on requested a review from cakebaker November 6, 2025 10:17
@ya7on
Copy link
Contributor Author

ya7on commented Nov 6, 2025

Some tests failed due to some Fedora-related issue. It doesn’t seem to be related to my code.

@cakebaker cakebaker merged commit 45fd3c9 into uutils:main Nov 6, 2025
119 of 121 checks passed
@cakebaker
Copy link
Contributor

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!

@ya7on ya7on deleted the fix_tests_in_printenv branch November 6, 2025 13:35
naoNao89 pushed a commit to naoNao89/coreutils that referenced this pull request Nov 9, 2025
* tests/printenv: add more tests

* tests/printenv: use clearer checks in tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants