[K/N][test] Test for ^KT-59497
diff --git a/kotlin-native/backend.native/tests/build.gradle b/kotlin-native/backend.native/tests/build.gradle
index 1c0351f..f05ed2a 100644
--- a/kotlin-native/backend.native/tests/build.gradle
+++ b/kotlin-native/backend.native/tests/build.gradle
@@ -4478,6 +4478,10 @@
flags = [ "-tr" ]
}
+standaloneTest("simpleClassName") {
+ source = "interop/simpleName.kt"
+}
+
interopTest("interop_cppClass") {
disabled = isAppleTarget(project) // KT-58422
source = "interop/cpp/cppClass.kt"
diff --git a/kotlin-native/backend.native/tests/interop/simpleName.kt b/kotlin-native/backend.native/tests/interop/simpleName.kt
new file mode 100644
index 0000000..b739cf2
--- /dev/null
+++ b/kotlin-native/backend.native/tests/interop/simpleName.kt
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
+ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
+ */
+
+import platform.darwin.NSObject
+import kotlinx.cinterop.*
+import kotlin.test.assertEquals
+
+class Name : NSObject() {
+ fun simpleName(): String? = this::class.simpleName
+ fun qualifiedName(): String? = this::class.qualifiedName
+}
+
+@ExportObjCClass(name = "ExportedClass")
+class ExportedName : NSObject() {
+ fun simpleName(): String? = this::class.simpleName
+ fun qualifiedName(): String? = this::class.qualifiedName
+}
+
+@ExportObjCClass()
+class ExportedNoName : NSObject() {
+ fun simpleName(): String? = this::class.simpleName
+ fun qualifiedName(): String? = this::class.qualifiedName
+}
+
+fun main() {
+ assertEquals("Name", Name().simpleName())
+ assertEquals("Name", Name().qualifiedName())
+
+ assertEquals("ExportedClass", ExportedName().simpleName())
+ assertEquals("ExportedClass", ExportedName().qualifiedName())
+
+ assertEquals("ExportedNoName", ExportedNoName().simpleName())
+ assertEquals("ExportedNoName", ExportedNoName().qualifiedName())
+}
\ No newline at end of file