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
fix tests which failed on Windows because \r\n vs \n #4744
Conversation
attn @martijnhoekstra. thx for calling this to my attention |
That's fine for tests, but the interpolator is a general (internal) facility. It might make more sense to have a normalizator for testing purposes (possibly normalizing test output and expected value). Cf https://github.com/scala/scala/blob/v2.11.7/src/compiler/scala/tools/util/PathResolver.scala#L40 Utils for tests: https://github.com/scala/scala/tree/2.11.x/test/junit/scala/tools/testing Typical normalizing: https://github.com/scala/scala/blob/2.11.x/src/partest-extras/scala/tools/partest/ReplTest.scala#L49 Similarly: https://github.com/scala/scala/blob/2.11.x/test/junit/scala/StringContextTest.scala#L68 |
@@ -217,4 +217,7 @@ class NullnessAnalyzerTest extends ClearAfterClass { | |||
(trim, 3, NotNull) // receiver at `trim` | |||
)) testNullness(a, m, insn, index, nullness) | |||
} | |||
|
|||
// add "sm" interpolator | |||
implicit class StrContextStripMarginOps(val stringContext: StringContext) extends scala.reflect.internal.util.StripMarginInterpolator |
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.
There is a ready made implicit class importable from scala.reflect.internal.util.StringContextStripMarginOps
.
scala> import scala.reflect.internal.util.StringContextStripMarginOps
import scala.reflect.internal.util.StringContextStripMarginOps
scala> sm"foo"
res0: String = foo
Maybe the mental tax of the escaped I think I prefer the idea of a custom |
a number of the tests are I have pushed an additional commit that makes it so that fwiw, the interpolator was already in use in test/junit/scala/reflect/internal/PrintersTest.scala, so that's a precedent for using it in additional tests. |
|
ah, that's a more serious objection. hmm... EDIT: or not that serious? I assume it's not uncommon for people to sling both |
Jason and I discussed this by video chat just now. He argues that we should 1) configure our Windows CI setup to check the files out with Unix line endings and 2) tell Windows developers experiencing test failures to do the same. Then no code changes are needed — not now, and not in the inevitable "long tail" of future incidents where somebody understandably forgets to use @martijnhoekstra how about just telling your git client to use LF endings on the Scala repo; does that resolve it for you? |
I've verified on jenkins-worker-windows-publish that adding |
@SethTisue I'll double check if it resolves my issues as well, but seeing that it works for Jenkins it should also work for me. This is most likely the most pragmatic solution. Now that I am looking in to this deeper, there are still newline related issues remaining that are probably not in the scope of this PR anymore, but it seems to be rather messy as a whole. |
opened https://issues.scala-lang.org/browse/SI-9472 on this. closing this PR since it doesn't look like we'll be merging it. |
with these changes, all of our JUnit tests are passing again on Windows.
(I'll deal with partest failures, if there any, in a separate PR.)
review by @retronym (thx for the string interpolator!)