From 5df923920c77e28b2a5dd47672fff267dfbabc4f Mon Sep 17 00:00:00 2001 From: sergeych Date: Wed, 12 Nov 2025 13:01:35 +0100 Subject: [PATCH] more test for apply --- lynglib/src/commonTest/kotlin/ScriptTest.kt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lynglib/src/commonTest/kotlin/ScriptTest.kt b/lynglib/src/commonTest/kotlin/ScriptTest.kt index a09b835..e56ab04 100644 --- a/lynglib/src/commonTest/kotlin/ScriptTest.kt +++ b/lynglib/src/commonTest/kotlin/ScriptTest.kt @@ -2506,6 +2506,27 @@ class ScriptTest { ) } + @Test + fun testApplyFromStatic() = runTest { + eval( + """ + class Foo(value) { + + fun test() { + "test: "+value + } + static val instance = Foo("bar") + } + + Foo.instance.apply { + assertEquals("bar", value) + assertEquals("test: bar", test()) + } + + """.trimIndent() + ) + } + @Test fun testExtend() = runTest() { eval(