From 243d6aed50e1540bcddfdfec26115fc658aa6cb9 Mon Sep 17 00:00:00 2001 From: Vladimir Sukharev Date: Tue, 13 Feb 2024 23:26:54 +0100 Subject: [PATCH] [K/N][Tests] Add test for KT-65659 ^KT-65659 --- .../native.tests/testData/framework/kt65659.kt | 9 +++++++++ .../konan/test/blackbox/FrameworkTest.kt | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 native/native.tests/testData/framework/kt65659.kt diff --git a/native/native.tests/testData/framework/kt65659.kt b/native/native.tests/testData/framework/kt65659.kt new file mode 100644 index 00000000000..31ac7e1dbd4 --- /dev/null +++ b/native/native.tests/testData/framework/kt65659.kt @@ -0,0 +1,9 @@ +typealias MyThrows = kotlin.Throws + +class Foo { + @kotlin.Throws(Exception::class) + fun noalias() {} + + @MyThrows(Exception::class) + fun aliased() {} +} diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/FrameworkTest.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/FrameworkTest.kt index 035494b70e5..b6481ad1cba 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/FrameworkTest.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/FrameworkTest.kt @@ -21,6 +21,7 @@ import org.jetbrains.kotlin.native.executors.runProcess import org.jetbrains.kotlin.test.KtAssert.fail import org.jetbrains.kotlin.test.services.JUnit5Assertions.assertTrue import org.junit.jupiter.api.Assumptions +import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Tag import org.junit.jupiter.api.Test import java.io.File @@ -40,6 +41,23 @@ abstract class FrameworkTestBase : AbstractNativeSimpleTest() { private val extras = TestCase.NoTestRunnerExtras("There's no entrypoint in Swift program") private val testCompilationFactory = TestCompilationFactory() + @Disabled("KT-65659 is not yet fixed for K2") + @Test + fun testKT65659() { + Assumptions.assumeTrue(targets.testTarget.family.isAppleFamily) + val testDataFile = testSuiteDir.resolve("kt65659.kt") + val testCase = generateObjCFrameworkTestCase( + TestKind.STANDALONE_NO_TR, + extras, + "kt65659", + listOf(testDataFile), + TestCompilerArgs(listOf("-Xbinary=bundleId=kt65659")), + ) + val objCFrameworkCompilation = testCompilationFactory.testCaseToObjCFrameworkCompilation(testCase, testRunSettings) + val compilationResult = objCFrameworkCompilation.result.assertSuccess() + assertTrue(compilationResult.resultingArtifact.mainHeader.readText().contains("aliasedAndReturnError")) + } + @Test fun testSignextZeroext() { Assumptions.assumeTrue(targets.testTarget.family.isAppleFamily)