Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
skiko
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liuqiang
skiko
Commits
d2c2fa33
Unverified
Commit
d2c2fa33
authored
Oct 22, 2021
by
Nikolay Igotti
Committed by
GitHub
Oct 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ios test with resource (#302)
parent
bb9cefcb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
Utils.kt
skiko/src/iosTest/kotlin/org/jetbrains/skiko/Utils.kt
+31
-0
data.txt
skiko/src/iosTest/resources/data.txt
+1
-0
No files found.
skiko/src/iosTest/kotlin/org/jetbrains/skiko/Utils.kt
0 → 100644
View file @
d2c2fa33
package
org.jetbrains.skiko
import
kotlinx.cinterop.addressOf
import
kotlinx.cinterop.toKString
import
kotlinx.cinterop.usePinned
import
platform.Foundation.NSBundle
import
platform.posix.*
import
kotlin.test.Test
import
kotlin.test.assertEquals
import
kotlin.test.assertTrue
fun
resourcePath
():
String
{
val
kexeDir
=
NSBundle
.
mainBundle
.
bundlePath
// Binary currently compiled into `build/bin/iosX64/debugTest`.
return
"$kexeDir/../../../../src/iosTest/resources"
}
class
BasicIosTests
{
@Test
fun
resourceAccess
()
{
val
path
=
"${resourcePath()}/data.txt"
val
f
=
fopen
(
path
,
"r"
)
?:
throw
Error
(
"cannot open $path: ${strerror(errno)?.toKString()}"
)
val
buf
=
ByteArray
(
200
)
buf
.
usePinned
{
val
rv
=
fread
(
it
.
addressOf
(
0
),
1
,
buf
.
size
.
toULong
(),
f
)
assertTrue
{
rv
!=
0
UL
}
}
assertEquals
(
"This is test data.\n"
,
buf
.
toKString
())
fclose
(
f
)
}
}
skiko/src/iosTest/resources/data.txt
0 → 100644
View file @
d2c2fa33
This is test data.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment