Add one more test for mangling top-levels in ObjCExport

This commit is contained in:
Svyatoslav Scherbina
2020-10-09 11:44:28 +03:00
committed by SvyatoslavScherbina
parent 4c04702636
commit 1b37e869dd
3 changed files with 11 additions and 0 deletions
@@ -611,6 +611,8 @@ __attribute__((objc_subclassing_restricted))
__attribute__((swift_name("TopLevelManglingAKt")))
@interface KtTopLevelManglingAKt : KtBase
+ (NSString *)foo __attribute__((swift_name("foo()")));
+ (int32_t)sameNumberValue:(int32_t)value __attribute__((swift_name("sameNumber(value:)")));
+ (int64_t)sameNumberValue:(int64_t)value __attribute__((swift_name("sameNumber(value:)")));
@property (class, readonly) NSString *bar __attribute__((swift_name("bar")));
@end;
@@ -10,11 +10,17 @@ private func testPropertiesInDifferentFilesAreNotMangled() throws {
try assertEquals(actual: TopLevelManglingBKt.bar, expected: "b2")
}
private func testFunctionsInSameFileAreMangled() throws {
try assertEquals(actual: TopLevelManglingAKt.sameNumber(value: Int32(1)), expected: 1)
try assertEquals(actual: TopLevelManglingAKt.sameNumber(value_: Int64(2)), expected: 2)
}
class TopLevelManglingTests : SimpleTestProvider {
override init() {
super.init()
test("TestFunctionsInDifferentFilesAreNotMangled", testFunctionsInDifferentFilesAreNotMangled)
test("TestPropertiesInDifferentFilesAreNotMangled", testPropertiesInDifferentFilesAreNotMangled)
test("TestFunctionsInSameFileAreMangled", testFunctionsInSameFileAreMangled)
}
}
@@ -2,3 +2,6 @@ package topLevelManglingA
fun foo() = "a1"
val bar = "a2"
fun sameNumber(value: Int) = value
fun sameNumber(value: Long) = value