JS: use eval instead of js in tests to refer local declarations to avoid renaming by resolveTemporaryNames

This commit is contained in:
Alexey Andreev
2017-02-08 16:08:25 +03:00
committed by Alexey Andreev
parent ce1eabdf6f
commit c1627e840b
5 changed files with 6 additions and 6 deletions
@@ -20,8 +20,8 @@ fun box(): String {
assertEquals("A::foo", f())
assertEquals("B::boo", g())
val fs: String = js("B\$far\$lambda").toString()
val gs = (js("B\$gar\$lambda").toString() as String).replaceAll("boo", "foo").replaceAll("gar", "far")
val fs: String = eval("B\$far\$lambda").toString()
val gs = (eval("B\$gar\$lambda").toString() as String).replaceAll("boo", "foo").replaceAll("gar", "far")
assertEquals(gs, fs)
@@ -15,7 +15,7 @@ internal external fun internal_baz(a: String) {
definedExternally
}
private fun getCurrentPackage(): dynamic = js("_").foo
private fun getCurrentPackage(): dynamic = eval("_").foo
private fun private_baz(i: Int) {
}
@@ -57,7 +57,7 @@ fun callInternalFunctions() {
package foo
private val currentPackage: dynamic
get() = js("\$module\$lib").foo
get() = eval("\$module\$lib").foo
private fun instantiate(classRef: dynamic, param: dynamic = js("undefined")) = js("new classRef(param)")
@@ -28,7 +28,7 @@ open class A {
fun foo() {}
fun box(): String {
val aBody = js("A").toString()
val aBody = eval("A").toString()
val expectedRegex = build {
property("a")
field("b")
@@ -25,7 +25,7 @@ fun box(): String {
if (!hasProp(b, "foo")) return "B hasn't foo"
if (!hasProp(b, "boo")) return "B hasn't boo"
val PREFIX = "JS_TESTS.foo"
val PREFIX = "_.foo"
if (eval("$PREFIX.A") == null) return "$PREFIX.A not found"
if (eval("$PREFIX.B") == null) return "$PREFIX.B not found"
if (eval("$PREFIX.A === $PREFIX.B") as Boolean) return "A and B refer to the same object"