backend/tests: add more interop tests

This commit is contained in:
Svyatoslav Scherbina
2017-02-07 13:43:37 +07:00
committed by SvyatoslavScherbina
parent 59f65e9b3f
commit 19dbdf3137
4 changed files with 36 additions and 0 deletions
+24
View File
@@ -1081,6 +1081,18 @@ kotlinNativeInterop {
headers 'sys/stat.h'
target 'native'
}
cstdlib {
pkg 'cstdlib'
headers 'stdlib.h'
target 'native'
}
cstdio {
defFile 'interop/basics/cstdio.def'
target 'native'
compilerOpts '-D_POSIX_SOURCE' // Exclude Darwin extensions causing link errors.
}
}
task interop0(type: RunInteropKonanTest) {
@@ -1088,3 +1100,15 @@ task interop0(type: RunInteropKonanTest) {
source = "interop/basics/0.kt"
interop = 'sysstat'
}
task interop1(type: RunInteropKonanTest) {
goldValue = "257\n"
source = "interop/basics/1.kt"
interop = 'cstdlib'
}
task interop2(type: RunInteropKonanTest) {
goldValue = "Hello\n"
source = "interop/basics/2.kt"
interop = 'cstdio'
}
+5
View File
@@ -0,0 +1,5 @@
import cstdlib.*
fun main(args: Array<String>) {
println(atoi("257"))
}
+5
View File
@@ -0,0 +1,5 @@
import cstdio.*
fun main(args: Array<String>) {
puts("Hello")
}
@@ -0,0 +1,2 @@
headers = stdio.h
excludedFunctions = _IO_flockfile _IO_funlockfile _IO_ftrylockfile _IO_cleanup_region_start _IO_cleanup_region_end