"cache" bug found and fixed, causing some improvemts in lambda processing.
This commit is contained in:
1 parent
ce021e85f4
commit
ce0fc3650d
7 files changed
+137
-36
No files matched your search
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2025 Sergey S. Chernov real.sergeych@gmail.com
|
||||
* Copyright 2026 Sergey S. Chernov real.sergeych@gmail.com
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -396,4 +396,26 @@ class OOTest {
|
||||
assertThrows { "answer is 42".totalDigits }
|
||||
""".trimIndent())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testCacheInClass() = runTest {
|
||||
eval("""
|
||||
class T(salt) {
|
||||
private var c
|
||||
|
||||
init {
|
||||
println("create cached with "+salt)
|
||||
c = cached { salt + "." }
|
||||
}
|
||||
|
||||
fun getResult() = c()
|
||||
}
|
||||
|
||||
val t1 = T("foo")
|
||||
val t2 = T("bar")
|
||||
assertEquals("bar.", t2.getResult())
|
||||
assertEquals("foo.", t1.getResult())
|
||||
|
||||
""".trimIndent())
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user