added test for scope locality
This commit is contained in:
parent
6eabcc315f
commit
1e6dd89778
@ -1770,7 +1770,7 @@ class ScriptTest {
|
|||||||
@Test
|
@Test
|
||||||
fun testIntExponentRealForm() = runTest {
|
fun testIntExponentRealForm() = runTest {
|
||||||
when(val x = eval("1e-6").toString()) {
|
when(val x = eval("1e-6").toString()) {
|
||||||
"0.000001", "1E-6", "1e-6" -> true
|
"0.000001", "1E-6", "1e-6" -> {}
|
||||||
else -> fail("Excepted 1e-6 got $x")
|
else -> fail("Excepted 1e-6 got $x")
|
||||||
}
|
}
|
||||||
// assertEquals("1.0E-6", eval("1e-6").toString())
|
// assertEquals("1.0E-6", eval("1e-6").toString())
|
||||||
@ -3460,7 +3460,7 @@ class ScriptTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
///@Test
|
// @Test
|
||||||
fun testMinimumOptimization() = runTest {
|
fun testMinimumOptimization() = runTest {
|
||||||
for (i in 1..200) {
|
for (i in 1..200) {
|
||||||
bm {
|
bm {
|
||||||
@ -3501,4 +3501,22 @@ class ScriptTest {
|
|||||||
.trimIndent()
|
.trimIndent()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun extensionsMustBeLocalPerScope() = runTest {
|
||||||
|
val scope1 = Script.newScope()
|
||||||
|
|
||||||
|
// extension foo should be local to scope1
|
||||||
|
assertEquals("a_foo", scope1.eval("""
|
||||||
|
fun String.foo() { this + "_foo" }
|
||||||
|
"a".foo()
|
||||||
|
""".trimIndent()).toString())
|
||||||
|
|
||||||
|
val scope2 = Script.newScope()
|
||||||
|
assertEquals("a_bar", scope2.eval("""
|
||||||
|
fun String.foo() { this + "_bar" }
|
||||||
|
"a".foo()
|
||||||
|
""".trimIndent()).toString())
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user