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
StdOutputStream final linefeed ambiguity. #750
Comments
We took a look at this and you're right. This is the default behavior of
We'll be picking one soon. |
After a bit of poking around, I'm going to say it's best if we change how |
... he said two months ago. But we're making progress, @bkuker, and I'm positive we have something for you before November runs out. 😬 |
Hey, the wheels grind slowly, but they grind fine! Thanks! |
Behavior change in
|
The method `capturedLines()` on `StdIn`, `StdOut`, and `StdErr` now includes trailing empty lines. So for code like... ```java System.out.println(); System.out.println("JUnit Pioneer 🚀"); System.out.println(); ``` ... `capturedLines` looks differently: * before: `["", "JUnit Pioneer 🚀"]` * now: `["", "JUnit Pioneer 🚀", ""]` If code only reads/prints empty lines, these will now also be correctly reported. Note that `capturedLines` still can't distinguish between output that ended with `print` vs `println`. The newly added method `capturedString` provides that capability. Closes: #750 PR: #754
StdOutputStream
'scapturedLines()
method takes the string output and splits it by the system line separator, returning an array.The returned array will be identical whether or not the final line written to standard out has a newline at the end, as
String.split
treats the split character and the end of the string the same.You therefore can not test that the final line written to STDOUT ends with a linefeed.
This is a nitpick but I suppose it could matter to someone.
I'd suggest simply adding an additional public
String capturedString()
method that returns the entire output unchanged.The text was updated successfully, but these errors were encountered: