Skip to content

Fix line and path separators in test #23534

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Jul 16, 2025

Fixes #23458

Splitting on NL leaves the CR if present. Just use linesIterator.

Introduce a template method for rendering paths. The test reporter replaces windows convention when run on windows, so that check files are correct; FileDiff.matches currently accounts for comparing lines of text when run on windows.

Previously, a TestReporter with empty console output would contribute a NL because "".split("\n") is not empty. (There is a test reporter per compilation group.)

@som-snytt
Copy link
Contributor Author

som-snytt commented Jul 16, 2025

A NL is dropped from check files of bootstrapped neg-macros but it's not obvious how to supply the update flag.

Edit: just scala3-bootstrapped/testCompilation --update-checkfiles and not testOnly.

@som-snytt som-snytt force-pushed the issue/23458-update-check branch from db2c829 to 31b4fd4 Compare July 16, 2025 15:27
@som-snytt
Copy link
Contributor Author

Spurious windows_fast failure.

@som-snytt som-snytt force-pushed the issue/23458-update-check branch from 31b4fd4 to c6fa07f Compare July 17, 2025 12:41
@som-snytt som-snytt force-pushed the issue/23458-update-check branch from c6fa07f to 2d3adb2 Compare July 19, 2025 15:38
@som-snytt
Copy link
Contributor Author

som-snytt commented Jul 19, 2025

That's a nice idea! Did you actually try it again under windows to see if it akshually works?

Edit: the TestReporter's ConsoleReporter (its consoleOutput) is used for the check file, so that is where the path fix is required.

Probably the TestReporter is not used to report a path in a diagnostic, but it also translates paths, because why not.

The test rig reports "local" paths as usual, but the diagnostics don't include a path (which would be normalized).

Note, of course, how sbt "progress" collides with test rig output, which is still quite annoying and provides no value.

Windows example where a spurious // warn is reported:

Wrong number of warnings encountered when compiling tests\warn\i15503g.scala
expected: 8, actual: 7 / Test / testOnly 9s
Unfulfilled expectations:
tests\warn\i15503g.scala:27

-> following the diagnostics:
 at 8: unused explicit parameter
 at 9: unused implicit parameter
 at 10: unused explicit parameter
 at 10: unused implicit parameter
 at 11: unused explicit parameter
 at 23: unused explicit parameter in extension method isAnIssue
 at 29: unused implicit parameter in extension method repeat

In fact getMissingExpectedWarnings constructs the file path with File.separator.

@som-snytt som-snytt force-pushed the issue/23458-update-check branch from 2d3adb2 to 45afde7 Compare July 19, 2025 16:57
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.

--update-checkfiles generates double line breaks on Windows?
1 participant