[Gradle] Add a test for KT-38317
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle.native
|
||||
|
||||
import org.gradle.util.GradleVersion
|
||||
import org.jetbrains.kotlin.gradle.testbase.*
|
||||
import org.junit.jupiter.api.DisplayName
|
||||
import org.junit.jupiter.api.condition.EnabledOnOs
|
||||
import org.junit.jupiter.api.condition.OS
|
||||
|
||||
@DisplayName("tests for the K/N simulator test infrastructure")
|
||||
@NativeGradlePluginTests
|
||||
@EnabledOnOs(OS.MAC)
|
||||
class NativeXcodeSimulatorTestsIT : KGPBaseTest() {
|
||||
@DisplayName("iOS simulator test with an https request fails with default settings")
|
||||
@GradleTest
|
||||
fun checkSimulatorTestFailsInStandaloneMode(gradleVersion: GradleVersion) {
|
||||
project("native-test-ios-https-request", gradleVersion) {
|
||||
buildAndFail("check") {
|
||||
// that's an Apple's issue that we expect to fail the build
|
||||
assertOutputContains("The certificate for this server is invalid. You might be connecting to a server that is pretending to be ")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
plugins {
|
||||
id("org.jetbrains.kotlin.multiplatform")
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
iosSimulatorArm64()
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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 kotlinx.cinterop.*
|
||||
import platform.Foundation.*
|
||||
import kotlin.test.*
|
||||
|
||||
@Test
|
||||
fun fooTest() {
|
||||
println("foo")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun request() {
|
||||
val response = memScoped {
|
||||
val request = NSURLRequest(NSURL(string = "https://cache-redirector.jetbrains.com/"))
|
||||
val responseRef = alloc<ObjCObjectVar<NSURLResponse?>>()
|
||||
val errorRef = alloc<ObjCObjectVar<NSError?>>()
|
||||
NSURLConnection.sendSynchronousRequest(request, responseRef.ptr, errorRef.ptr) ?:
|
||||
throw Error(errorRef.value?.toString() ?: "")
|
||||
responseRef.value!! as NSHTTPURLResponse
|
||||
}
|
||||
kotlin.test.assertEquals(200, response.statusCode)
|
||||
}
|
||||
Reference in New Issue
Block a user