diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2022-09-24 01:37:21 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-24 01:37:21 +0800 |
commit | 37ca97dd76c8e02228338c68aa3c5aed03074ed2 (patch) | |
tree | 9c5ca2cc6739a49bb58f74d1876456c7a12a4503 /tests | |
parent | 7739e23420c9a7a4ec7eccdddc0a39df9e905aa8 (diff) | |
download | Nim-37ca97dd76c8e02228338c68aa3c5aed03074ed2.tar.gz |
close #15955; add a test case (#20414)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/misc/m15955.nim | 4 | ||||
-rw-r--r-- | tests/misc/m15955_main.nim | 11 | ||||
-rw-r--r-- | tests/misc/t15955.nim | 22 |
3 files changed, 37 insertions, 0 deletions
diff --git a/tests/misc/m15955.nim b/tests/misc/m15955.nim new file mode 100644 index 000000000..22da345db --- /dev/null +++ b/tests/misc/m15955.nim @@ -0,0 +1,4 @@ +proc add*(a, b: int): int {.cdecl, exportc.} = + a + b +proc sub*(a, b: int): int {.cdecl, exportc.} = + a - b \ No newline at end of file diff --git a/tests/misc/m15955_main.nim b/tests/misc/m15955_main.nim new file mode 100644 index 000000000..a71af8121 --- /dev/null +++ b/tests/misc/m15955_main.nim @@ -0,0 +1,11 @@ +import stdtest/specialpaths +import std/os + +const buildLib = buildDir / "libD20220923T19380" + +{.passL: buildLib.} +proc add*(a, b: int):int {.cdecl, importc.} +proc sub*(a, b: int):int {.cdecl, importc.} + +echo add(10, 5) +echo sub(10, 5) diff --git a/tests/misc/t15955.nim b/tests/misc/t15955.nim new file mode 100644 index 000000000..7441e5398 --- /dev/null +++ b/tests/misc/t15955.nim @@ -0,0 +1,22 @@ +discard """ +joinable: false +""" + +import stdtest/specialpaths +import std/[osproc, strformat, os] + +const + nim = getCurrentCompilerExe() + buildLib = buildDir / "libD20220923T19380" + currentDir = splitFile(currentSourcePath).dir + file = currentDir / "m15955.nim" + main = currentDir / "m15955_main.nim" + + +proc runCmd(cmd: string) = + let (msg, code) = execCmdEx(cmd) + doAssert code == 0, msg + + +runCmd fmt"{nim} c -o:{buildLib} --nomain --nimMainPrefix:libA -f --app:staticlib {file}" +runCmd fmt"{nim} c -r {main}" |