This repository was 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
test: Remove @JSExportTopLevel
from test-suites functions
#17
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It seems we can eliminate other objects even if they are in the same package (
testsuite.core
)