From 1937823a779eaa2f1949fb4ca94c8c7ae12fc468 Mon Sep 17 00:00:00 2001 From: pTalanov Date: Tue, 5 Jun 2012 21:53:53 +0400 Subject: [PATCH] Test for evaluating properties lazily --- .../org/jetbrains/k2js/test/semantics/MiscTest.java | 3 +++ .../testFiles/expression/misc/cases/lazyProperty.kt | 11 +++++++++++ 2 files changed, 14 insertions(+) create mode 100644 js/js.translator/testFiles/expression/misc/cases/lazyProperty.kt diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/MiscTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/MiscTest.java index 9828978cd3a..f98cf55b87e 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/MiscTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/MiscTest.java @@ -144,6 +144,9 @@ public final class MiscTest extends AbstractExpressionTest { fooBoxTest(); } + public void testLazyPropertyGetterNotCalledOnStart() throws Exception { + checkOutput("lazyProperty.kt", "Hello, world! Gotcha 3"); + } public void testExclExclThrows() throws Exception { try { diff --git a/js/js.translator/testFiles/expression/misc/cases/lazyProperty.kt b/js/js.translator/testFiles/expression/misc/cases/lazyProperty.kt new file mode 100644 index 00000000000..16eae2156bf --- /dev/null +++ b/js/js.translator/testFiles/expression/misc/cases/lazyProperty.kt @@ -0,0 +1,11 @@ +fun main(args : Array) { + println("Hello, world!") + println(p) +} + + +val p: Int +get() { + println("Gotcha") + return 3 +} \ No newline at end of file