Skip to content

Commit 6533759

Browse files
Merge pull request scala#12745 from dotty-staging/sjs-fix-junit-test-mangled-names
Scala.js: Mangle test names when generating JUnit bootstrappers.
2 parents 15185cc + 332c727 commit 6533759

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

compiler/src/dotty/tools/dotc/transform/sjs/JUnitBootstrappers.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class JUnitBootstrappers extends MiniPhase {
223223

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

@@ -266,7 +266,7 @@ class JUnitBootstrappers extends MiniPhase {
266266
val tp = junitdefn.NoSuchMethodExceptionType
267267
Throw(resolveConstructor(tp, nameParamRef :: Nil))
268268
} { (test, next) =>
269-
If(Literal(Constant(test.name.toString)).select(defn.Any_equals).appliedTo(nameParamRef),
269+
If(Literal(Constant(test.name.mangledString)).select(defn.Any_equals).appliedTo(nameParamRef),
270270
genTestInvocation(testClass, test, ref(castInstanceSym)),
271271
next)
272272
}

project/Build.scala

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,18 +1182,6 @@ object Build {
11821182
++ (dir / "js/src/test/scala-new-collections" ** "*.scala").get
11831183
)
11841184
},
1185-
1186-
// A second blacklist for tests that compile and link, but do not pass at run-time.
1187-
// Putting them here instead of above makes sure that we do not regress on compilation+linking.
1188-
Test / testOptions += Tests.Filter { name =>
1189-
!Set[String](
1190-
// Not investigated so far
1191-
"org.scalajs.testsuite.junit.JUnitAbstractClassTestCheck",
1192-
"org.scalajs.testsuite.junit.JUnitNamesTestCheck",
1193-
"org.scalajs.testsuite.junit.JUnitSubClassTestCheck",
1194-
"org.scalajs.testsuite.junit.MultiCompilationSecondUnitTestCheck",
1195-
).contains(name)
1196-
}
11971185
)
11981186

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

0 commit comments

Comments
 (0)