Skip to content

Commit 31259a2

Browse files
committed
Add a JSEnv test using the default filesystem
This is a follow-up from scala-js/scala-js#3646.
1 parent 6ece659 commit 31259a2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

js-envs-test-kit/src/main/scala/org/scalajs/jsenv/test/RunTests.scala

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
package org.scalajs.jsenv.test
1414

15+
import java.io.File
16+
import java.nio.charset.StandardCharsets
17+
import java.nio.file.Files
18+
1519
import com.google.common.jimfs.Jimfs
1620

1721
import org.junit.Assume._
@@ -142,6 +146,24 @@ private[test] class RunTests(config: JSEnvSuiteConfig, withCom: Boolean) {
142146
}
143147
}
144148

149+
@Test
150+
def defaultFilesystem: Unit = {
151+
// Tests that a JSEnv works with files from the default filesystem.
152+
153+
val tmpFile = File.createTempFile("sjs-run-test-defaultfile", ".js")
154+
try {
155+
val tmpPath = tmpFile.toPath
156+
Files.write(tmpPath, "console.log(\"test\");".getBytes(StandardCharsets.UTF_8))
157+
158+
withRun(Input.ScriptsToLoad(tmpPath :: Nil)) {
159+
_.expectOut("test\n")
160+
.closeRun()
161+
}
162+
} finally {
163+
tmpFile.delete()
164+
}
165+
}
166+
145167
/* This test verifies that a [[JSEnv]] properly validates its [[RunConfig]]
146168
* (through [[RunConfig.Validator]]).
147169
*

0 commit comments

Comments
 (0)