This repository has been archived by the owner on Jul 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from tanishiking/test-start-function
test: Remove `@JSExportTopLevel` from test-suites functions
- Loading branch information
Showing
16 changed files
with
272 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
package cli | ||
|
||
object TestSuites { | ||
case class TestSuite(className: String, methodName: String) | ||
case class TestSuite(className: String, methodName: String = "main") | ||
val suites = List( | ||
TestSuite("testsuite.core.simple.Simple", "simple"), | ||
TestSuite("testsuite.core.add.Add", "add"), | ||
TestSuite("testsuite.core.add.Add", "add"), | ||
TestSuite("testsuite.core.virtualdispatch.VirtualDispatch", "virtualDispatch"), | ||
TestSuite("testsuite.core.interfacecall.InterfaceCall", "interfaceCall"), | ||
TestSuite("testsuite.core.asinstanceof.AsInstanceOfTest", "asInstanceOf"), | ||
TestSuite("testsuite.core.jsinterop.JSInteropTest", "jsInterop"), | ||
TestSuite("testsuite.core.hijackedclassesdispatch.HijackedClassesDispatchTest", "hijackedClassesDispatch"), | ||
TestSuite("testsuite.core.hijackedclassesmono.HijackedClassesMonoTest", "hijackedClassesMono"), | ||
TestSuite("testsuite.core.hijackedclassesupcast.HijackedClassesUpcastTest", "hijackedClassesUpcast"), | ||
TestSuite("testsuite.core.tostring.ToStringTest", "toStringConversions") | ||
TestSuite("testsuite.core.Simple"), | ||
TestSuite("testsuite.core.Add"), | ||
TestSuite("testsuite.core.VirtualDispatch"), | ||
TestSuite("testsuite.core.InterfaceCall"), | ||
TestSuite("testsuite.core.AsInstanceOfTest"), | ||
TestSuite("testsuite.core.JSInteropTest"), | ||
TestSuite("testsuite.core.HijackedClassesDispatchTest"), | ||
TestSuite("testsuite.core.HijackedClassesMonoTest"), | ||
TestSuite("testsuite.core.HijackedClassesUpcastTest"), | ||
TestSuite("testsuite.core.ToStringTest") | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package testsuite | ||
|
||
/** Temporary assertion method on Scala for Wasm. `ok` method generates `unreachable` if the given | ||
* condition is false, trapping at runtime. | ||
* | ||
* While it's desirable to eventually utilize Scala's assertion, it's currently unavailable because | ||
* we cannot compile Throwable to wasm yet, thus throw new (Throwable) is unusable. and making | ||
* assert unavailable as well. | ||
* | ||
* Using JS's assert isn't feasible either; `console.assert` merely displays a message when | ||
* assertion failure, and Node's assert module is unsupported for Wasm due to current | ||
* unavailability of `JSImport` and module. | ||
*/ | ||
object Assert { | ||
def ok(cond: Boolean): Unit = | ||
if (!cond) null.toString() // Apply to Null should compile to unreachable | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
package testsuite.core.add | ||
package testsuite.core | ||
|
||
import scala.scalajs.js.annotation._ | ||
import testsuite.Assert.ok | ||
|
||
object Add { | ||
def main(): Unit = { val _ = test() } | ||
@JSExportTopLevel("add") | ||
def test(): Boolean = { | ||
1 + 1 == 2 | ||
def main(): Unit = { | ||
ok(1 + 1 == 2) | ||
} | ||
} |
17 changes: 8 additions & 9 deletions
17
test-suite/src/main/scala/testsuite/core/AsInstanceOfTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 33 additions & 34 deletions
67
test-suite/src/main/scala/testsuite/core/HijackedClassesDispatchTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 4 additions & 7 deletions
11
test-suite/src/main/scala/testsuite/core/InterfaceCall.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.