KJS: fix JS backend tests on windows

This commit is contained in:
Zalim Bashorov
2017-04-28 14:15:03 +03:00
parent e841fceea0
commit 87db245dd8
2 changed files with 3 additions and 2 deletions
@@ -28,7 +28,7 @@ fun createScriptEngine(): ScriptEngine =
NashornScriptEngineFactory().getScriptEngine("--language=es5", "--no-java", "--no-syntax-extensions")
private fun ScriptEngine.loadFile(path: String) {
eval("load('$path');")
eval("load('${path.replace('\\', '/')}');")
}
private fun ScriptObjectMirror.toMapWithAllMembers(): Map<String, Any?> = getOwnKeys(true).associate { it to this[it] }
@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.js.test.semantics
import com.google.common.collect.Lists
import com.intellij.openapi.util.text.StringUtil
import org.jetbrains.kotlin.js.facade.MainCallParameters
import org.jetbrains.kotlin.js.test.BasicBoxTest
import org.jetbrains.kotlin.js.test.NashornJsTestChecker
@@ -45,7 +46,7 @@ abstract class AbstractWebDemoExamplesTest(relativePath: String) : BasicBoxTest(
}
protected fun runMainAndCheckOutputWithExpectedFile(testName: String, testId: String, vararg args: String) {
val expectedResult = File(pathToTestDir + testName + testId + ".out").readText()
val expectedResult = StringUtil.convertLineSeparators(File(pathToTestDir + testName + testId + ".out").readText())
doTest(pathToTestDir + testName + ".kt", expectedResult, MainCallParameters.mainWithArguments(Lists.newArrayList(*args)))
}
}