Skip to content

Scala.js: Mangle test names when generating JUnit bootstrappers. #12745

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class JUnitBootstrappers extends MiniPhase {

DefDef(sym, {
val metadata = for (test <- tests) yield {
val name = Literal(Constant(test.name.toString))
val name = Literal(Constant(test.name.mangledString))
val ignored = Literal(Constant(test.hasAnnotation(junitdefn.IgnoreAnnotClass)))
val testAnnot = test.getAnnotation(junitdefn.TestAnnotClass).get

Expand Down Expand Up @@ -266,7 +266,7 @@ class JUnitBootstrappers extends MiniPhase {
val tp = junitdefn.NoSuchMethodExceptionType
Throw(resolveConstructor(tp, nameParamRef :: Nil))
} { (test, next) =>
If(Literal(Constant(test.name.toString)).select(defn.Any_equals).appliedTo(nameParamRef),
If(Literal(Constant(test.name.mangledString)).select(defn.Any_equals).appliedTo(nameParamRef),
genTestInvocation(testClass, test, ref(castInstanceSym)),
next)
}
Expand Down
12 changes: 0 additions & 12 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1183,18 +1183,6 @@ object Build {
++ (dir / "js/src/test/scala-new-collections" ** "*.scala").get
)
},

// A second blacklist for tests that compile and link, but do not pass at run-time.
// Putting them here instead of above makes sure that we do not regress on compilation+linking.
Test / testOptions += Tests.Filter { name =>
!Set[String](
// Not investigated so far
"org.scalajs.testsuite.junit.JUnitAbstractClassTestCheck",
"org.scalajs.testsuite.junit.JUnitNamesTestCheck",
"org.scalajs.testsuite.junit.JUnitSubClassTestCheck",
"org.scalajs.testsuite.junit.MultiCompilationSecondUnitTestCheck",
).contains(name)
}
)

lazy val sjsCompilerTests = project.in(file("sjs-compiler-tests")).
Expand Down