Add test for KT-43517 and KT-43530

This commit is contained in:
Sergey Bogolepov
2020-11-24 15:27:26 +07:00
committed by Stanislav Erokhin
parent 30345c3708
commit 12723fb009
4 changed files with 63 additions and 0 deletions
@@ -3800,6 +3800,9 @@ if (PlatformInfo.isAppleTarget(project)) {
it.defFile 'interop/objc/illegal_sharing_with_weak/objclib.def'
it.headers "$projectDir/interop/objc/illegal_sharing_with_weak/objclib.h"
}
createInterop("objcKt43517") {
it.defFile 'framework/kt43517/kt43517.def'
}
}
createInterop("withSpaces") {
@@ -4672,6 +4675,14 @@ if (isAppleTarget(project)) {
}
swiftSources = ['framework/kt42397']
}
frameworkTest("testKt43517Framework") {
framework('Kt43517') {
sources = ['framework/kt43517']
library = 'objcKt43517'
}
swiftSources = ['framework/kt43517/']
}
}
/**
@@ -0,0 +1,15 @@
---
enum E {
A, B, C
};
struct S {
int i;
float f;
};
struct S globalS = { .i = 3, .f = 3.14f };
enum E createEnum() {
return A;
}
@@ -0,0 +1,13 @@
import kt43517.*
fun produceEnum(): E =
createEnum()
fun compareEnums(e1: E, e2: E): Boolean =
e1 == e2
fun getFirstField(s: S): Int =
s.i
fun getGlobalS(): S =
globalS
@@ -0,0 +1,24 @@
import Foundation
import Kt43517
func testKt43517() throws {
try assertEquals(
actual: Kt43517Kt.compareEnums(e1: Kt43517Kt.produceEnum(), e2: Kt43517Kt.produceEnum()),
expected: true
)
try assertEquals(
actual: Kt43517Kt.getFirstField(s: Kt43517Kt.getGlobalS()),
expected: 3
)
}
class Kt43517Tests : TestProvider {
var tests: [TestCase] = []
init() {
providers.append(self)
tests = [
TestCase(name: "Kt43517", method: withAutorelease(testKt43517)),
]
}
}