[PL][tests] Keep PL test data under "testData/klib/" dir
This commit is contained in:
committed by
Space Team
parent
9e3afe7a1f
commit
5c3e63e19a
+26
@@ -0,0 +1,26 @@
|
||||
package lib1
|
||||
|
||||
abstract class AbstractClassWithFunctions {
|
||||
fun foo(): Int = 42
|
||||
open fun bar(): Int = 42
|
||||
open fun baz(): Int = 42
|
||||
}
|
||||
|
||||
interface InterfaceWithFunctions {
|
||||
fun foo(): Int = 42
|
||||
fun bar(): Int = 42
|
||||
}
|
||||
|
||||
abstract class AbstractClassWithProperties {
|
||||
val foo1: Int = 42
|
||||
val foo2: Int get() = 42
|
||||
open val bar1: Int = 42
|
||||
open val bar2: Int get() = 42
|
||||
open val baz1: Int = 42
|
||||
open val baz2: Int get() = 42
|
||||
}
|
||||
|
||||
interface InterfaceWithProperties {
|
||||
val foo: Int get() = 42
|
||||
val bar: Int get() = 42
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package lib1
|
||||
|
||||
abstract class AbstractClassWithFunctions {
|
||||
abstract fun foo(): Int
|
||||
abstract fun bar(): Int
|
||||
abstract fun baz(): Int
|
||||
}
|
||||
|
||||
interface InterfaceWithFunctions {
|
||||
fun foo(): Int
|
||||
fun bar(): Int
|
||||
}
|
||||
|
||||
abstract class AbstractClassWithProperties {
|
||||
abstract val foo1: Int
|
||||
abstract val foo2: Int
|
||||
abstract val bar1: Int
|
||||
abstract val bar2: Int
|
||||
abstract val baz1: Int
|
||||
abstract val baz2: Int
|
||||
}
|
||||
|
||||
interface InterfaceWithProperties {
|
||||
val foo: Int
|
||||
val bar: Int
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
STEP 0:
|
||||
dependencies: stdlib
|
||||
modifications:
|
||||
U : l1.kt.0 -> l1.kt
|
||||
STEP 1:
|
||||
dependencies: stdlib
|
||||
modifications:
|
||||
U : l1.kt.1 -> l1.kt
|
||||
STEP 2:
|
||||
dependencies: stdlib
|
||||
modifications:
|
||||
U : l1.kt.0 -> l1.kt
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package lib2
|
||||
|
||||
import lib1.*
|
||||
|
||||
class AbstractClassWithFunctionsImpl1 : AbstractClassWithFunctions() {
|
||||
override fun baz() = -42
|
||||
val unlinkedFunctionUsage get() = foo() + bar()
|
||||
}
|
||||
|
||||
class AbstractClassWithFunctionsImpl2 : AbstractClassWithFunctions() {
|
||||
override fun baz() = -42
|
||||
val unlinkedFunctionUsage = foo() // Expected failure on class instance initialization.
|
||||
}
|
||||
|
||||
class AbstractClassWithFunctionsImpl3 : AbstractClassWithFunctions() {
|
||||
override fun baz() = -42
|
||||
val unlinkedFunctionUsage = bar() // Expected failure on class instance initialization.
|
||||
}
|
||||
|
||||
class InterfaceWithFunctionsImpl1 : InterfaceWithFunctions {
|
||||
override fun bar() = -42
|
||||
val unlinkedFunctionUsage get() = foo()
|
||||
}
|
||||
|
||||
class InterfaceWithFunctionsImpl2 : InterfaceWithFunctions {
|
||||
override fun bar() = -42
|
||||
val unlinkedFunctionUsage = foo() // Expected failure on class instance initialization.
|
||||
}
|
||||
|
||||
class AbstractClassWithPropertiesImpl1 : AbstractClassWithProperties() {
|
||||
override val baz1 = -42
|
||||
override val baz2 get() = -42
|
||||
val unlinkedPropertyUsage get() = foo1 + foo2 + bar1 + bar2
|
||||
}
|
||||
|
||||
class AbstractClassWithPropertiesImpl2 : AbstractClassWithProperties() {
|
||||
override val baz1 = -42
|
||||
override val baz2 get() = -42
|
||||
val unlinkedPropertyUsage = foo1
|
||||
}
|
||||
|
||||
class AbstractClassWithPropertiesImpl3 : AbstractClassWithProperties() {
|
||||
override val baz1 = -42
|
||||
override val baz2 get() = -42
|
||||
val unlinkedPropertyUsage = foo2
|
||||
}
|
||||
|
||||
class AbstractClassWithPropertiesImpl4 : AbstractClassWithProperties() {
|
||||
override val baz1 = -42
|
||||
override val baz2 get() = -42
|
||||
val unlinkedPropertyUsage = bar1
|
||||
}
|
||||
|
||||
class AbstractClassWithPropertiesImpl5 : AbstractClassWithProperties() {
|
||||
override val baz1 = -42
|
||||
override val baz2 get() = -42
|
||||
val unlinkedPropertyUsage = bar2
|
||||
}
|
||||
|
||||
class InterfaceWithPropertiesImpl1 : InterfaceWithProperties {
|
||||
override val bar get() = -42
|
||||
val unlinkedPropertyUsage get() = foo
|
||||
}
|
||||
|
||||
class InterfaceWithPropertiesImpl2 : InterfaceWithProperties {
|
||||
override val bar get() = -42
|
||||
val unlinkedPropertyUsage = foo
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
STEP 0:
|
||||
dependencies: stdlib, lib1
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
import abitestutils.abiTest
|
||||
import lib1.*
|
||||
import lib2.*
|
||||
|
||||
fun box() = abiTest {
|
||||
val abstractClassWithFunctions: AbstractClassWithFunctions = AbstractClassWithFunctionsImpl1()
|
||||
val abstractClassWithFunctionsImpl1 = AbstractClassWithFunctionsImpl1()
|
||||
val interfaceWithFunctions: InterfaceWithFunctions = InterfaceWithFunctionsImpl1()
|
||||
val interfaceWithFunctionsImpl1 = InterfaceWithFunctionsImpl1()
|
||||
val abstractClassWithProperties: AbstractClassWithProperties = AbstractClassWithPropertiesImpl1()
|
||||
val abstractClassWithPropertiesImpl1 = AbstractClassWithPropertiesImpl1()
|
||||
val interfaceWithProperties: InterfaceWithProperties = InterfaceWithPropertiesImpl1()
|
||||
val interfaceWithPropertiesImpl1 = InterfaceWithPropertiesImpl1()
|
||||
|
||||
expectFailure(nonImplementedCallable("function 'foo'", "class 'AbstractClassWithFunctionsImpl1'")) { abstractClassWithFunctions.foo() }
|
||||
expectFailure(nonImplementedCallable("function 'bar'", "class 'AbstractClassWithFunctionsImpl1'")) { abstractClassWithFunctions.bar() }
|
||||
expectSuccess(-42) { abstractClassWithFunctions.baz() }
|
||||
expectFailure(nonImplementedCallable("function 'foo'", "class 'AbstractClassWithFunctionsImpl1'")) { abstractClassWithFunctionsImpl1.unlinkedFunctionUsage }
|
||||
expectFailure(nonImplementedCallable("function 'foo'", "class 'AbstractClassWithFunctionsImpl2'")) { AbstractClassWithFunctionsImpl2() }
|
||||
expectFailure(nonImplementedCallable("function 'bar'", "class 'AbstractClassWithFunctionsImpl3'")) { AbstractClassWithFunctionsImpl3() }
|
||||
|
||||
expectFailure(nonImplementedCallable("function 'foo'", "class 'InterfaceWithFunctionsImpl1'")) { interfaceWithFunctions.foo() }
|
||||
expectSuccess(-42) { interfaceWithFunctions.bar() }
|
||||
expectFailure(nonImplementedCallable("function 'foo'", "class 'InterfaceWithFunctionsImpl1'")) { interfaceWithFunctionsImpl1.unlinkedFunctionUsage }
|
||||
expectFailure(nonImplementedCallable("function 'foo'", "class 'InterfaceWithFunctionsImpl2'")) { InterfaceWithFunctionsImpl2() }
|
||||
|
||||
expectFailure(nonImplementedCallable("property accessor 'foo1.<get-foo1>'", "class 'AbstractClassWithPropertiesImpl1'")) { abstractClassWithProperties.foo1 }
|
||||
expectFailure(nonImplementedCallable("property accessor 'foo2.<get-foo2>'", "class 'AbstractClassWithPropertiesImpl1'")) { abstractClassWithProperties.foo2 }
|
||||
expectFailure(nonImplementedCallable("property accessor 'bar1.<get-bar1>'", "class 'AbstractClassWithPropertiesImpl1'")) { abstractClassWithProperties.bar1 }
|
||||
expectFailure(nonImplementedCallable("property accessor 'bar2.<get-bar2>'", "class 'AbstractClassWithPropertiesImpl1'")) { abstractClassWithProperties.bar2 }
|
||||
expectSuccess(-42) { abstractClassWithProperties.baz1 }
|
||||
expectSuccess(-42) { abstractClassWithProperties.baz2 }
|
||||
expectFailure(nonImplementedCallable("property accessor 'foo1.<get-foo1>'", "class 'AbstractClassWithPropertiesImpl1'")) { abstractClassWithPropertiesImpl1.unlinkedPropertyUsage }
|
||||
expectFailure(nonImplementedCallable("property accessor 'foo1.<get-foo1>'", "class 'AbstractClassWithPropertiesImpl2'")) { AbstractClassWithPropertiesImpl2() }
|
||||
expectFailure(nonImplementedCallable("property accessor 'foo2.<get-foo2>'", "class 'AbstractClassWithPropertiesImpl3'")) { AbstractClassWithPropertiesImpl3() }
|
||||
expectFailure(nonImplementedCallable("property accessor 'bar1.<get-bar1>'", "class 'AbstractClassWithPropertiesImpl4'")) { AbstractClassWithPropertiesImpl4() }
|
||||
expectFailure(nonImplementedCallable("property accessor 'bar2.<get-bar2>'", "class 'AbstractClassWithPropertiesImpl5'")) { AbstractClassWithPropertiesImpl5() }
|
||||
|
||||
expectFailure(nonImplementedCallable("property accessor 'foo.<get-foo>'", "class 'InterfaceWithPropertiesImpl1'")) { interfaceWithProperties.foo }
|
||||
expectSuccess(-42) { interfaceWithProperties.bar }
|
||||
expectFailure(nonImplementedCallable("property accessor 'foo.<get-foo>'", "class 'InterfaceWithPropertiesImpl1'")) { interfaceWithPropertiesImpl1.unlinkedPropertyUsage }
|
||||
expectFailure(nonImplementedCallable("property accessor 'foo.<get-foo>'", "class 'InterfaceWithPropertiesImpl2'")) { InterfaceWithPropertiesImpl2() }
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
STEP 0:
|
||||
dependencies: stdlib, lib1, lib2
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
MODULES: lib1, lib2, main
|
||||
|
||||
STEP 0:
|
||||
libs: lib1, lib2, main
|
||||
|
||||
STEP 1:
|
||||
libs: lib1
|
||||
Reference in New Issue
Block a user