-
Notifications
You must be signed in to change notification settings - Fork 4
Import the JS Envs projects from the Scala.js core repository. #1
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
Changes from all commits
Commits
Show all changes
150 commits
Select commit
Hold shift + click to select a range
5cef245
Fix scala-js/scala-js#446: Make setting out of jsEnv (and sanitize st…
gzm0 f335399
Fix scala-js/scala-js#441: Add Node.js environment
gzm0 59f457a
Fix scala-js/scala-js#500: Avoid removal of duplicate percentage sign…
gzm0 63bebcf
Fix scala-js/scala-js#561: Make hacked Node.js console accept non-Str…
gzm0 1423cf6
Add JS dependency tracking via manifests.
gzm0 9629ea0
Add full support for projects requiring DOM
gzm0 8c71267
Send printlns to the console, not the logger.
sjrd 8f4a06e
Merge pull request scala-js/scala-js#587 from sjrd/fix-console-log-ou…
gzm0 89f4229
Fix scala-js/scala-js#610: Restructure classpaths for clean linking API
gzm0 037d57a
Fix scala-js/scala-js#688: Remove return value of JSEnv#runJS.
gzm0 65f0a3f
Fix scala-js/scala-js#740: Allow to run stuff with names that are not…
gzm0 a962a32
Fix scala-js/scala-js#799: Make PhantomJS runner fail if JS code fails
gzm0 3e26c6c
Fix scala-js/scala-js#865: Inherit existing shell environment in exte…
gzm0 9c11baf
Fix scala-js/scala-js#706: Add mechanism to support CommonJS style re…
gzm0 577a49f
Cross-build Scala.js tools
gzm0 2d9d124
Implement System.exit() through environment setting (scala-js/scala-j…
gzm0 b0ab774
Fix scala-js/scala-js#1016: Respect NODE_PATH from the environment.
gzm0 350652e
Fix scala-js/scala-js#1054: Automatically enable source-map-support i…
gzm0 3dbe808
Remove deprecated members
gzm0 7f012bb
Fix scala-js/scala-js#1163: Remove packager and non-direct full optim…
gzm0 d023c68
Refactor JSEnv to support async running
gzm0 a96ecd6
Remove JSEnv constructor-blow up. Use default args
gzm0 c98cb19
Add ComJSEnv and make RhinoJSEnv a ComJSEnv
gzm0 6abedd5
Make NodeJSEnv a ComJSEnv
gzm0 7744c34
Get rid of unnamed tuple in CompleteClasspath
gzm0 509d7a0
Fix scala-js/scala-js#1240: Add stop() to AsyncJSEnv
gzm0 13946a5
Merge pull request scala-js/scala-js#1246 from gzm0/async-stop
sjrd b2f790a
Fix scala-js/scala-js#1239: Don't assume in ExtJSEnv that VM supports…
gzm0 a797c41
Fix scala-js/scala-js#1241: Add Future based API to AsyncJSEnv
gzm0 8dada1f
Fix scala-js/scala-js#1266: Proper connection closing on Node.js ComJ…
gzm0 478bba9
Increase max supported message size for NodeJSEnv
gzm0 3064e5d
Additional tests for ComJSEnvs
gzm0 6203577
Fix scala-js/scala-js#1304: Fragment messages to limit total size to …
gzm0 5573bbe
Centralize overriding of stop in ComJSEnv
gzm0 1fba71f
Improve information in thrown ComClosedExceptions
gzm0 ee10cd4
Fix scala-js/scala-js#1073: New test framework interface (aligned wit…
gzm0 8688060
Decouple VirtualFileMaterializer from sbt.IO
gzm0 a4fe854
Remove sbtplugin.JSUtils
gzm0 150ee02
Fix scala-js/scala-js#1287: Reorganize package names and artifacts
gzm0 2b3dee7
Fix scala-js/scala-js#1325: Repeatedly decode incoming Node.js Com me…
gzm0 3a11645
Get rid of ugly isAlive hack
gzm0 5eec47d
Fix scala-js/scala-js#1328: Handle socket errors in Node.js com
gzm0 de318a2
Add a JSEnv test for future completion when stopping (closes scala-js…
gzm0 7078273
Restructure AsyncJSRunner to be Future based
gzm0 a75473b
Fix scala-js/scala-js#1315: Add timeout to AsyncJSRunner.await and us…
gzm0 c2706f5
Fix scala-js/scala-js#1343: Add a RetryingComJSEnv and use it for CI
gzm0 4f976a1
Fix scala-js/scala-js#1059: Add a (basic) way to turn off source mapping
gzm0 8340efb
Only fail JSEnv test if log is bad
gzm0 a2363a6
Fix scala-js/scala-js#1321: Implement setTimeout (et al.) in Rhino
gzm0 da14e87
Fix scala-js/scala-js#1377: Remove flakyness of JSEnv test
gzm0 a9c4fe9
Add source map support detection to NodeJSEnv
gzm0 a386982
Automatically set correct tags for tests
gzm0 87cab2a
Fix scala-js/scala-js#1377 (again): Stabilize JSEnv timeout tests
gzm0 ada787c
Merge pull request scala-js/scala-js#1380 from gzm0/auto-tags
sjrd f31e1b7
Add support for timeouts in ComJSRunner.receive().
sjrd c5f19e5
Strengthen the guarantees of AsyncJSRunner.stop().
sjrd 84f63eb
Fix scala-js/scala-js#1452: PhantomJS sometimes doesn't shut down pro…
sjrd 50b5b67
Fix scala-js/scala-js#1482: Node.js throws if JVM closes connection t…
gzm0 15feede
Fix scala-js/scala-js#1536: NodeJSEnv is unable to send characters la…
gzm0 4606eec
Increase Node.js' connection timeout to 5 s.
sjrd a82b8c3
Move NodeJSEnv.acceptTimeout as a protected val.
sjrd 0141889
Add a customInitFiles() hook in ExternalJSEnv.
sjrd 593e07b
Fix a bunch of style issues discovered by Scalastyle.
sjrd 27a842c
Add Scalastyle with a basic configuration.
sjrd e215281
Fix scala-js/scala-js#1917: Add -Xfatal-warnings for ScalaDoc generation
gzm0 0c85ccd
Fix scala-js/scala-js#1990: Do not duplicate % for 1-arg console.log …
sjrd c1e3714
Factor basic JSEnv tests in trait
gzm0 b4f5755
Fix scala-js/scala-js#2053: Always use UTF8 in PhantomJSEnv
gzm0 c3f97a3
Log exact command executed by ExternalJSEnv.
nicolasstucki bcb242d
Fix minor typo in doc
gzm0 4370568
Tools refactoring
gzm0 eac5177
Make private everything that can be in tools and js-envs.
sjrd a814cc3
Add DOMJSEnv based on 'jsdom' in Node.js.
nicolasstucki 3ffff10
Fix scala-js/scala-js#2250: Split jsEnvs, creating jsEnvsTestKit, jsE…
nicolasstucki 6f1be71
Fix scala-js/scala-js#2375: Move Node and Phantom CustomInitFilesTest…
nicolasstucki 03388d4
Fix scala-js/scala-js#2368: Support single-arg setTimeout in Rhino
gzm0 ac662e6
Fix scala-js/scala-js#2376: PhantomJSEnv does not escape JS code
gzm0 b21dab5
Remove LinkingUnitJSEnv.
sjrd 5c64e4d
Move the implemention of commonJSName to the sbt plugin.
sjrd 86fedd1
Use VirtualJSFiles instead of ResolvedJSDependency in the JSEnv API.
sjrd a236c71
Unify the parameter names of external JS env constructors.
sjrd 3711a9b
Merge '0.6.x' into 'master'.
sjrd c02c1bd
Fix scala-js/scala-js#2874: Remove the distinction libs/code in the J…
sjrd 6558802
Fix scala-js/scala-js#2875: Remove JSEnv.loadLibs, resolvedJSEnv and …
sjrd 67d9982
Separate all jsDependencies-related things in separate projects.
sjrd ba9e5a0
Avoid using `sys.env`.
sjrd 590927c
Merge '0.6.x' into 'master'.
sjrd 44cd5ab
Introduce a new surface API for JS envs with `Config` objects.
sjrd 709ef34
Merge '0.6.x' into 'master'.
sjrd cedc304
Remove the deprecated APIs in JS envs.
sjrd 927b8b1
Fix scala-js/scala-js#2877: Internal JS envs config amenable to binco…
sjrd a2310a8
Extract JSDOMNodeJSEnv in its own project.
sjrd 52c8510
Mitigate scala-js/scala-js#3206: Send stderr of Node.js to the `JSCon…
sjrd b54c2f9
Merge '0.6.x' into 'master'.
sjrd f7f33df
Make the constructors and underlying vals of AnyVals private.
sjrd 068d9d5
Move `ir.Utils.escapeJS` to `io.JSUtils`.
sjrd 81b911d
Get rid of the `core` and `tools` package namespaces.
sjrd 392e44a
Fix scala-js/scala-js#3033: Rehaul JSEnv API
gzm0 1135bac
Reduce acceptTimeout
eatkins 7c6e5fe
Remove VirtualFileMaterializer
gzm0 050b9d7
Use VirtualBinaryFile in jsenv.Input
gzm0 61feecc
Merge '0.6.x' into 'master'.
sjrd 5c9a28c
Fix scala-js/scala-js#3351: Use Buffer.alloc and Buffer.from instead …
sjrd f48f51d
Remove most of the VirtualFile API that is now unused.
gzm0 4ccb51a
Make MemVirtualBinaryFile immutable
gzm0 918865e
Merge pull request scala-js/scala-js#3347 from gzm0/no-js-files
gzm0 3266e12
Merge '0.6.x' into 'master'.
sjrd dcd5ed3
Fix scala-js/scala-js#3393: Correctly report VM crashes as failed fut…
sjrd d95880a
Merge '0.6.x' into 'master'.
sjrd ede2024
Fix scala-js/scala-js#3400: Do not crash if source-map-support is una…
sjrd 6401ae1
[no-master] Fix scala-js/scala-js#3408: Survive concurrent calls to `…
sjrd 183409d
Fix scala-js/scala-js#3410: Add supportsExit to JSEnvSuiteConfig.
gzm0 40e8167
Fix scala-js/scala-js#3412: Throw an IOException in noThrowOnBadFileTest
gzm0 3a03cce
Fix scala-js/scala-js#3411: Do not call onMessage immediately after init
gzm0 cf6a59b
Backport exception tests from SeleniumJSEnv
gzm0 d3b0c92
Fix a typo in a method name
gzm0 4c7068f
Fix scala-js/scala-js#3420: Make timeout tests less restrictive
gzm0 052901f
Skip the [no-master] commits ecd52f4dd and 65c123d2a
gzm0 6b3cc5f
Simplify largeMessage test
gzm0 c563156
Fix scala-js/scala-js#3457: Give timeout tests some slack
gzm0 e65a1d2
Fix scala-js/scala-js#3414: Better test kit
gzm0 e057dfc
Replace FrameworkDetector test with JSEnv test
gzm0 fdad432
Fix scala-js/scala-js#3462: Apache License Version 2.0.
sjrd 396acc1
Merge '0.6.x' into 'master'.
sjrd ccd71b6
Fix scala-js/scala-js#3476: Specify that com messages must be valid U…
sjrd e2032ac
[no-master] Fix scala-js/scala-js#2175: Add support for ECMAScript 20…
sjrd 116600c
Make `UnsupportedInputException` a normal (non-case) class.
sjrd 802518a
Add the distinction between Script and CommonJS module in Input.
sjrd 2a81c37
Fix scala-js/scala-js#2175: Add support for ECMAScript 2015 modules.
sjrd 339cfe0
Merge '0.6.x' into 'master'.
sjrd b4a627f
Remove the hack to fix percentage signs in Node.js.
sjrd a46ed82
Remove System.exit / __ScalaJSEnv.exitFunction
gzm0 0d65d88
[no-master] Fix scala-js/scala-js#3528: Use `console.error(e)` to rep…
sjrd 6b18524
Skip the [no-master] commit 12a7988.
sjrd 5938bcb
Make JSEnvSuite compile warning free on Java 9
gzm0 628443b
Split `escapeJS` in `linker` and `js-envs`.
sjrd 6ece659
Fix scala-js/scala-js#3589: Use java.nio.file.Path instead of Virtual…
gzm0 31259a2
Add a JSEnv test using the default filesystem
gzm0 94c5ec3
Fix several typos in comments and debug strings
asakaev 1169011
[no-master] Remove `@deprecatedName`s that were introduced in 0.6.16.
sjrd ffa58d2
[no-master] Enable Scala 2.13.0 in the tools and all the other artifa…
sjrd df599a8
Enable Scala 2.13.0 in the linker and all the other artifacts.
sjrd 2b26cbf
Skip the [no-master] commits until ab398e8d7.
sjrd 03edf0c
Remove two unused imports of `JavaConverters`.
sjrd 6fb7b91
Merge '0.6.x' into 'master'.
sjrd 23112c7
Fix scala-js/scala-js#3616: Do not force all JSEnv inputs to be of th…
gzm0 e7613ec
Fix typos
bwignall 7c7c509
Merge '0.6.x' into 'master'.
sjrd 9e0a9c0
Add `()` at relevant call sites in the JS env test kit.
sjrd f3a156c
Import the JS Envs projects from the Scala.js core repository.
sjrd 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
target/ |
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,31 @@ | ||
sudo: false | ||
language: scala | ||
script: | ||
- sbt ++$TRAVIS_SCALA_VERSION scalajs-js-envs/test | ||
- sbt ++$TRAVIS_SCALA_VERSION scalajs-js-envs/doc | ||
- sbt ++$TRAVIS_SCALA_VERSION scalajs-js-envs/mimaReportBinaryIssues | ||
- sbt ++$TRAVIS_SCALA_VERSION scalajs-js-envs/headerCheck scalajs-js-envs/test:headerCheck | ||
- sbt ++$TRAVIS_SCALA_VERSION scalajs-js-envs-test-kit/test | ||
- sbt ++$TRAVIS_SCALA_VERSION scalajs-js-envs-test-kit/doc | ||
- sbt ++$TRAVIS_SCALA_VERSION scalajs-js-envs-test-kit/mimaReportBinaryIssues | ||
- sbt ++$TRAVIS_SCALA_VERSION scalajs-js-envs-test-kit/headerCheck scalajs-js-envs-test-kit/test:headerCheck | ||
- sbt ++$TRAVIS_SCALA_VERSION scalajs-env-nodejs/test | ||
- sbt ++$TRAVIS_SCALA_VERSION scalajs-env-nodejs/doc | ||
- sbt ++$TRAVIS_SCALA_VERSION scalajs-env-nodejs/mimaReportBinaryIssues | ||
- sbt ++$TRAVIS_SCALA_VERSION scalajs-env-nodejs/headerCheck scalajs-env-nodejs/test:headerCheck | ||
scala: | ||
- 2.11.12 | ||
- 2.12.11 | ||
- 2.13.2 | ||
jdk: | ||
- openjdk8 | ||
|
||
cache: | ||
directories: | ||
- "$HOME/.cache/coursier" | ||
- "$HOME/.ivy2/cache" | ||
- "$HOME/.sbt" | ||
before_cache: | ||
- rm -fv $HOME/.ivy2/.sbt.ivy.lock | ||
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -print -delete | ||
- find $HOME/.sbt -name "*.lock" -print -delete |
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,143 @@ | ||
val previousVersion: Option[String] = Some("1.1.0") | ||
val newScalaBinaryVersionsInThisRelease: Set[String] = Set() | ||
|
||
inThisBuild(Def.settings( | ||
version := "1.1.1-SNAPSHOT", | ||
organization := "org.scala-js", | ||
scalaVersion := "2.12.11", | ||
crossScalaVersions := Seq("2.11.12", "2.12.11", "2.13.2"), | ||
scalacOptions ++= Seq( | ||
"-deprecation", | ||
"-feature", | ||
"-Xfatal-warnings", | ||
"-encoding", "utf-8", | ||
), | ||
|
||
// Licensing | ||
homepage := Some(url("https://github.com/scala-js/scala-js-js-envs")), | ||
startYear := Some(2013), | ||
licenses += (("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0"))), | ||
scmInfo := Some(ScmInfo( | ||
url("https://github.com/scala-js/scala-js-js-envs"), | ||
"scm:git:git@github.com:scala-js/scala-js-js-envs.git", | ||
Some("scm:git:git@github.com:scala-js/scala-js-js-envs.git"))), | ||
|
||
// Publishing | ||
publishMavenStyle := true, | ||
publishTo := { | ||
val nexus = "https://oss.sonatype.org/" | ||
if (version.value.endsWith("-SNAPSHOT")) | ||
Some("snapshots" at nexus + "content/repositories/snapshots") | ||
else | ||
Some("releases" at nexus + "service/local/staging/deploy/maven2") | ||
}, | ||
pomExtra := ( | ||
<developers> | ||
<developer> | ||
<id>sjrd</id> | ||
<name>Sébastien Doeraene</name> | ||
<url>https://github.com/sjrd/</url> | ||
</developer> | ||
<developer> | ||
<id>gzm0</id> | ||
<name>Tobias Schlatter</name> | ||
<url>https://github.com/gzm0/</url> | ||
</developer> | ||
<developer> | ||
<id>nicolasstucki</id> | ||
<name>Nicolas Stucki</name> | ||
<url>https://github.com/nicolasstucki/</url> | ||
</developer> | ||
</developers> | ||
), | ||
pomIncludeRepository := { _ => false }, | ||
)) | ||
|
||
val commonSettings = Def.settings( | ||
// Links to the JavaDoc do not work | ||
Compile / doc / scalacOptions -= "-Xfatal-warnings", | ||
|
||
// Scaladoc linking | ||
apiURL := { | ||
val name = moduleName.value | ||
val scalaBinVer = scalaBinaryVersion.value | ||
val ver = version.value | ||
Some(url(s"https://javadoc.io/doc/org.scala-js/${name}_$scalaBinVer/$ver/")) | ||
}, | ||
autoAPIMappings := true, | ||
|
||
// sbt-header configuration | ||
headerLicense := Some(HeaderLicense.Custom( | ||
s"""Scala.js JS Envs (${homepage.value.get}) | ||
| | ||
|Copyright EPFL. | ||
| | ||
|Licensed under Apache License 2.0 | ||
|(https://www.apache.org/licenses/LICENSE-2.0). | ||
| | ||
|See the NOTICE file distributed with this work for | ||
|additional information regarding copyright ownership. | ||
|""".stripMargin | ||
)), | ||
|
||
// MiMa auto-configuration | ||
mimaPreviousArtifacts ++= { | ||
val scalaV = scalaVersion.value | ||
val scalaBinaryV = scalaBinaryVersion.value | ||
val thisProjectID = projectID.value | ||
previousVersion match { | ||
case None => | ||
Set.empty | ||
case _ if newScalaBinaryVersionsInThisRelease.contains(scalaBinaryV) => | ||
// New in this release, no binary compatibility to comply to | ||
Set.empty | ||
case Some(prevVersion) => | ||
/* Filter out e:info.apiURL as it expects 1.1.1-SNAPSHOT, whereas the | ||
* artifact we're looking for has 1.1.0 (for example). | ||
*/ | ||
val prevExtraAttributes = | ||
thisProjectID.extraAttributes.filterKeys(_ != "e:info.apiURL") | ||
val prevProjectID = | ||
(thisProjectID.organization % thisProjectID.name % prevVersion) | ||
.cross(thisProjectID.crossVersion) | ||
.extra(prevExtraAttributes.toSeq: _*) | ||
Set(prevProjectID) | ||
} | ||
}, | ||
) | ||
|
||
lazy val root = project | ||
.in(file(".")) | ||
|
||
lazy val `scalajs-js-envs` = project | ||
.in(file("js-envs")) | ||
.settings( | ||
commonSettings, | ||
libraryDependencies ++= Seq( | ||
"org.scala-js" %% "scalajs-logging" % "1.1.1", | ||
"com.novocode" % "junit-interface" % "0.11" % "test", | ||
), | ||
) | ||
|
||
lazy val `scalajs-js-envs-test-kit` = project | ||
.in(file("js-envs-test-kit")) | ||
.settings( | ||
commonSettings, | ||
libraryDependencies ++= Seq( | ||
"com.google.jimfs" % "jimfs" % "1.1", | ||
"junit" % "junit" % "4.12", | ||
"com.novocode" % "junit-interface" % "0.11" % "test" | ||
), | ||
) | ||
.dependsOn(`scalajs-js-envs`) | ||
|
||
lazy val `scalajs-env-nodejs` = project | ||
.in(file("nodejs-env")) | ||
.settings( | ||
commonSettings, | ||
libraryDependencies ++= Seq( | ||
"com.google.jimfs" % "jimfs" % "1.1", | ||
"com.novocode" % "junit-interface" % "0.11" % "test" | ||
), | ||
) | ||
.dependsOn(`scalajs-js-envs`, `scalajs-js-envs-test-kit` % "test") |
151 changes: 151 additions & 0 deletions
151
js-envs-test-kit/src/main/scala/org/scalajs/jsenv/test/ComTests.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
/* | ||
* Scala.js JS Envs (https://github.com/scala-js/scala-js-js-envs) | ||
* | ||
* Copyright EPFL. | ||
* | ||
* Licensed under Apache License 2.0 | ||
* (https://www.apache.org/licenses/LICENSE-2.0). | ||
* | ||
* See the NOTICE file distributed with this work for | ||
* additional information regarding copyright ownership. | ||
*/ | ||
|
||
package org.scalajs.jsenv.test | ||
|
||
import org.junit.{Before, Test, AssumptionViolatedException} | ||
import org.junit.Assume._ | ||
|
||
import org.scalajs.jsenv._ | ||
import org.scalajs.jsenv.test.kit.TestKit | ||
|
||
private[test] class ComTests(config: JSEnvSuiteConfig) { | ||
private val kit = new TestKit(config.jsEnv, config.awaitTimeout) | ||
|
||
@Before | ||
def before: Unit = { | ||
assumeTrue("JSEnv needs com support", config.supportsCom) | ||
} | ||
|
||
@Test | ||
def basicTest: Unit = { | ||
kit.withComRun(""" | ||
scalajsCom.init(function(msg) { scalajsCom.send("received: " + msg); }); | ||
scalajsCom.send("Hello World"); | ||
""") { run => | ||
|
||
run.expectMsg("Hello World") | ||
|
||
for (i <- 0 to 10) { | ||
run | ||
.send(i.toString) | ||
.expectMsg(s"received: $i") | ||
} | ||
|
||
run.expectNoMsgs() | ||
.closeRun() | ||
} | ||
} | ||
|
||
@Test | ||
def jsExitsOnMessageTest: Unit = { | ||
val exitStat = config.exitJSStatement.getOrElse( | ||
throw new AssumptionViolatedException("JSEnv needs exitJSStatement")) | ||
|
||
kit.withComRun(s""" | ||
scalajsCom.init(function(msg) { $exitStat }); | ||
for (var i = 0; i < 10; ++i) | ||
scalajsCom.send("msg: " + i); | ||
""") { run => | ||
|
||
for (i <- 0 until 10) | ||
run.expectMsg(s"msg: $i") | ||
|
||
run | ||
.send("quit") | ||
.expectNoMsgs() | ||
.succeeds() | ||
} | ||
} | ||
|
||
@Test | ||
def multiEnvTest: Unit = { | ||
val n = 10 | ||
val runs = List.fill(5) { | ||
kit.startWithCom(""" | ||
scalajsCom.init(function(msg) { | ||
scalajsCom.send("pong"); | ||
}); | ||
""") | ||
} | ||
|
||
try { | ||
for (_ <- 0 until n) { | ||
runs.foreach(_.send("ping")) | ||
runs.foreach(_.expectMsg("pong")) | ||
} | ||
|
||
runs.foreach { | ||
_.expectNoMsgs() | ||
.closeRun() | ||
} | ||
} finally { | ||
runs.foreach(_.close()) | ||
} | ||
} | ||
|
||
private def replyTest(msg: String) = { | ||
kit.withComRun("scalajsCom.init(scalajsCom.send);") { | ||
_.send(msg) | ||
.expectMsg(msg) | ||
.expectNoMsgs() | ||
.closeRun() | ||
} | ||
} | ||
|
||
@Test | ||
def largeMessageTest: Unit = { | ||
/* 1MB data. | ||
* (i & 0x7f) limits the input to the ASCII repertoire, which will use | ||
* exactly 1 byte per Char in UTF-8. This restriction also ensures that we | ||
* do not introduce surrogate characters and therefore no invalid UTF-16 | ||
* strings. | ||
*/ | ||
replyTest(new String(Array.tabulate(1024 * 1024)(i => (i & 0x7f).toChar))) | ||
} | ||
|
||
@Test | ||
def highCharTest: Unit = { // #1536 | ||
replyTest("\uC421\u8F10\u0112\uFF32") | ||
} | ||
|
||
@Test | ||
def noInitTest: Unit = { | ||
kit.withComRun("") { | ||
_.send("Dummy") | ||
.expectNoMsgs() | ||
.closeRun() | ||
} | ||
} | ||
|
||
@Test | ||
def separateComStdoutTest: Unit = { | ||
// Make sure that com and stdout do not interfere with each other. | ||
kit.withComRun(""" | ||
scalajsCom.init(function (msg) { | ||
console.log("got: " + msg) | ||
}); | ||
console.log("a"); | ||
scalajsCom.send("b"); | ||
scalajsCom.send("c"); | ||
console.log("d"); | ||
""") { | ||
_.expectOut("a\n") | ||
.expectMsg("b") | ||
.expectMsg("c") | ||
.expectOut("d\n") | ||
.send("foo") | ||
.expectOut("got: foo\n") | ||
.closeRun() | ||
} | ||
} | ||
} |
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.
Note that I deactivate fatal warnings in Scaladoc, because links to the JavaDoc, including in
@throws
sections, do not work and report errors. We could fix this by doing all the heavy machinery that we do in scala-js/scala-js to patch up the JavaDoc links, but I found that overkill right now.