Skip to content

Commit 488e378

Browse files
committed
Cleanup duplicated test-suite-wasi code
Eliminate the copyed and tweaked test code from `test-suite` into `test-suite-wasi`. Previously, copy and tweaking was necessary before `junit-runtime` didn't work reliably under `targetPureWasm`. Now that `junit-runtime` is mostly functional in that environment, this commit removes the copied code and use a source dependency on `test-suite` in `test-suite-wasi` instead. Future test additions will no longer require code duplication, although the custom test runner logic for instantiation and invocation remains.
1 parent 242e5fc commit 488e378

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+101
-18818
lines changed

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,6 @@ val testSuiteLinker = Build.testSuiteLinker
4040
val partest = Build.partest
4141
val partestSuite = Build.partestSuite
4242
val scalaTestSuite = Build.scalaTestSuite
43+
val testSuiteSources = Build.testSuiteSources
4344

4445
inThisBuild(Build.thisBuildSettings)

examples/test-suite-wasi/src/main/scala/test-suites-wasi/CompilerTest.scala

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package testSuiteWASI
22

3-
import compiler._
3+
import org.scalajs.testsuite.compiler._
44

55
object CompilerTest {
66
def run(): Unit = {
@@ -15,14 +15,21 @@ object CompilerTest {
1515
negativeArraySizes()
1616
genericArrayNullsShortCircuited_Issue4755()
1717
}
18-
BooleanTest.bitwiseAndOrXorOperators()
19-
ByteTest.toByteAndToCharAreInRange()
20-
CharTest.toIntNegativeToPositive()
21-
CharTest.toIntOverflow()
22-
CharTest.multiplyOverflow()
23-
CharTest.doNotBoxSeveralTimesInBlock()
24-
CharTest.doNotBoxSeveralTimesInIf()
25-
ClassDiffersOnlyInCaseTest.testClassesThatDifferOnlyInCase_Issue4855()
18+
19+
(new BooleanTest).bitwiseAndOrXorOperators()
20+
(new ByteTest).toByteAndToCharAreInRange()
21+
22+
locally {
23+
val test = new CharTest
24+
import test._
25+
toIntNegativeToPositive()
26+
toIntOverflow()
27+
multiplyOverflow()
28+
doNotBoxSeveralTimesInBlock()
29+
doNotBoxSeveralTimesInIf()
30+
}
31+
32+
// (new ClassDiffersOnlyInCaseTest).testClassesThatDifferOnlyInCase_Issue4855()
2633

2734
locally {
2835
val test = new DefaultMethodsTest
@@ -124,7 +131,6 @@ object CompilerTest {
124131
moduloByZero()
125132
}
126133

127-
128134
locally {
129135
val test = new MatchTest
130136
test.switchWithGuardsStat()
@@ -170,7 +176,7 @@ object CompilerTest {
170176
test.compareToForPrimitives()
171177

172178
// TODO: float to string / long to string, runtime type check
173-
test.concatForPrimitives()
179+
// test.concatForPrimitives()
174180

175181
test.arrays()
176182
test.arraysOfPrimitiveValues()
@@ -179,10 +185,10 @@ object CompilerTest {
179185
test.bugCompatibleWithScalaJVMForInheritedOverloads()
180186
test.javaLangObjectNotifyNotifyAll_Issue303()
181187
test.javaLangObjectClone_Issue303()
182-
// test.scalaAnyRefEqNeSynchronized_Issue2709()
183188

189+
// test.scalaAnyRefEqNeSynchronized_Issue2709()
184190
// TODO: assertEquals("hellothere", objSynchronizedTest(a, "hello"))
185-
test.anyValEqNeSynchronized_Issue2709()
191+
// test.anyValEqNeSynchronized_Issue2709()
186192

187193
test.javaLangFloatDoubleIsNaNIsInfinite()
188194
test.defaultArguments_Issue390()

examples/test-suite-wasi/src/main/scala/test-suites-wasi/JavalibLangTest.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package testSuiteWASI
22

3-
import javalib.lang._
4-
import testSuiteWASI.compiler.ClassDiffersOnlyInCaseTest.testClassesThatDifferOnlyInCase_Issue4855
3+
import org.scalajs.testsuite.javalib.lang._
54

65
object JavalibLangTest {
76
def run(): Unit = {
@@ -239,7 +238,7 @@ object JavalibLangTest {
239238

240239
// TODO: JSBinaryOp 8: asInt parseString
241240
// new Integer("-12345").toString
242-
testToString()
241+
// testToString()
243242

244243
// TODO: JSMethodApply toString (enableJSNumberOps)
245244
// toStringRadix()
@@ -376,7 +375,7 @@ object JavalibLangTest {
376375
appendCharArrayOffsetLen()
377376

378377
// TODO: ltoa, float/double to string
379-
appendPrimitive()
378+
// appendPrimitive()
380379

381380
appendCodePoint()
382381
getChars()
@@ -622,8 +621,7 @@ object JavalibLangTest {
622621
throwableJSToStringCanBeOverridden()
623622

624623
// TODO: float to string / AssertionError("boom").getMessage fails
625-
assertionErrorsPeculiarConstructors()
626-
624+
// assertionErrorsPeculiarConstructors()
627625
}
628626
}
629627
}

examples/test-suite-wasi/src/main/scala/test-suites-wasi/JavalibUtilTest.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package testSuiteWASI
22

3-
import javalib.util._
3+
import org.scalajs.testsuite.javalib.util._
44

55
object JavalibUtilTest {
66
def run(): Unit = {
@@ -78,8 +78,6 @@ object JavalibUtilTest {
7878
copyOfAnyRefWithChangeOfType()
7979
copyOfRangeAnyRef()
8080
copyOfRangeAnyRefArrayIndexOutOfBoundsException()
81-
82-
8381
asList()
8482

8583
hashCodeBoolean()
@@ -103,7 +101,7 @@ object JavalibUtilTest {
103101
equalsDoubles()
104102

105103
deepEquals()
106-
toStringAnyRef()
104+
// toStringAnyRef()
107105

108106
// TODO: JSArrayConstr in deepToString
109107
// deepToString()
@@ -121,7 +119,6 @@ object JavalibUtilTest {
121119
requireNonNull()
122120
isNull()
123121
nonNull()
124-
125122
}
126123
}
127124
}

examples/test-suite-wasi/src/main/scala/test-suites-wasi/Platform.scala

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)