[K/N][Tests] Migrate tests kt49034*.kt
^KT-61259
This commit is contained in:
committed by
Space Team
parent
ae09c0fb60
commit
bd688b3ef7
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2010-2022 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.
|
||||
*/
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// `import objcnames` somehow works only with NATIVE_STANDALONE test directive
|
||||
// NATIVE_STANDALONE
|
||||
// The test checks no collision between kt49034.__darwin_fp_control and platform.posix.__darwin_fp_control
|
||||
// The test makes sense only on Apple x64 targets, where `class __darwin_fp_control` present in posix platform lib
|
||||
// DISABLE_NATIVE: isAppleTarget=false
|
||||
// DISABLE_NATIVE: targetArchitecture=ARM64
|
||||
|
||||
// MODULE: cinterop
|
||||
// FILE: kt49034.def
|
||||
headers = kt49034.h
|
||||
language = Objective-C
|
||||
|
||||
// FILE: kt49034.h
|
||||
@class __darwin_fp_control;
|
||||
void foo(__darwin_fp_control*);
|
||||
|
||||
// MODULE: main(cinterop)
|
||||
// FILE: main.kt
|
||||
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
|
||||
import objcnames.classes.__darwin_fp_control
|
||||
|
||||
open class C<T : kotlinx.cinterop.ObjCObject>
|
||||
|
||||
class D : C<__darwin_fp_control>()
|
||||
|
||||
fun box(): String {
|
||||
println(D())
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: checkPlatformDarwinFPControl.kt
|
||||
import platform.posix.__darwin_fp_control
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 2010-2022 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.
|
||||
*/
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// The test depends on collision between kt49034.JSContext and platform.JavaScriptCore.JSContext
|
||||
// DISABLE_NATIVE: isAppleTarget=false
|
||||
// There is no JavaScriptCore on watchOS.
|
||||
// DISABLE_NATIVE: targetFamily=WATCHOS
|
||||
|
||||
// MODULE: cinterop
|
||||
// FILE: kt49034.def
|
||||
headers = kt49034.h
|
||||
|
||||
// FILE: kt49034.h
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct JSContext;
|
||||
|
||||
struct JSContext* bar();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// FILE: impl.c
|
||||
#include "kt49034.h"
|
||||
|
||||
struct JSContext {
|
||||
int field;
|
||||
};
|
||||
|
||||
struct JSContext global = { 15 };
|
||||
|
||||
extern "C" struct JSContext* bar() {
|
||||
return &global;
|
||||
}
|
||||
|
||||
// MODULE: main(cinterop)
|
||||
// FILE: main.kt
|
||||
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
|
||||
import kt49034.bar
|
||||
import cnames.structs.JSContext
|
||||
import kotlinx.cinterop.CPointer
|
||||
|
||||
fun baz(s: CPointer<JSContext>) {
|
||||
println(s)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
baz(bar()!!)
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: checkPlatformJavaScriptCore.kt
|
||||
import platform.JavaScriptCore.JSContext
|
||||
Reference in New Issue
Block a user