Make printing test changes platform-independent


Two of the tickets included in 1.10.2 had additions to printing related tests: and CLJ-1445.

Those changes did not properly take into account platform-dependent line endings in expected test output. The attached patch updates those tests to match other existing tests in being platform independent.

Thanks to David Miller for the heads up pointing this out!

Patch: clj-2602-fix-v2.patch

Screened By: Fogus, v2 by Alex




Andy Fingerhut
January 12, 2021, 3:17 AM

I tried mvn clean ; mvn test on a Windows 10 machine using AdoptOpenJDK11 and the patch in clj-2602.patch, but it still failed 2 tests.

With the attached patch clj-2602-fix-v2.patch, all tests passed on that platform.

Alex Miller
January 12, 2021, 2:50 PM

why did you change the size of the ranges in test-print-meta?

Andy Fingerhut
January 12, 2021, 3:17 PM

When the expression containing r is pprint’ed on Linux and macOS, it puts all elements on the same line, without line breaks. When that expression is pprint’ed on Windows, it breaks all elements across 25 lines, and thus the test fails. With (range 24), all 3 platforms put all of the elements on the same line.

Why does Windows behave differently than the other platforms? That I have not dug into to discover fully. I believe all of the *print- … Vars have the same values on all platforms, so it isn’t that. My best guess is that the \r\n line separator on Windows might be causing pprint to count the \r as 1 character wider per line, but that is only a guess at this point.

Alex Miller
January 13, 2021, 8:55 PM

I think that's the right guess - I did pick a number there that was trying to get meta on its own line - this all plays with the miser-width and that stuff so it's kind of fiddly.

Alex Miller
January 15, 2021, 7:14 PM

In 1.10.2-rc3





Alex Miller





Code and Test

Fix versions

Affects versions