diff options
author | flywind <xzsflywind@gmail.com> | 2021-07-21 15:47:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-21 09:47:06 +0200 |
commit | f048dad7c3af7d70fbb852a59cb5bdda332e96d7 (patch) | |
tree | fbf692bcb118e440f7ff6b298d1f92cee66ffb9a | |
parent | 9c2442af94fc3db8486ee16e82ea27752e9ae4f5 (diff) | |
download | Nim-f048dad7c3af7d70fbb852a59cb5bdda332e96d7.tar.gz |
add testcase for #6499 #12229 #7172 (#18547)
-rw-r--r-- | tests/magics/tmagics.nim | 8 | ||||
-rw-r--r-- | tests/threads/t7172.nim | 32 |
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/magics/tmagics.nim b/tests/magics/tmagics.nim index fa138320c..70926a0d7 100644 --- a/tests/magics/tmagics.nim +++ b/tests/magics/tmagics.nim @@ -55,3 +55,11 @@ block t9442: GC_unref(v2) GC_ref(v3) GC_unref(v3) + +block: # bug #6499 + let x = (chr, 0) + doAssert x[1] == 0 + +block: # bug #12229 + proc foo(T: typedesc) = discard + foo(ref) diff --git a/tests/threads/t7172.nim b/tests/threads/t7172.nim new file mode 100644 index 000000000..983765dba --- /dev/null +++ b/tests/threads/t7172.nim @@ -0,0 +1,32 @@ +discard """ + output: ''' +In doStuff() +In initProcess() +initProcess() done +TEST +Crashes before getting here! +''' + joinable: false +""" + +import std/os + +proc whatever() {.thread, nimcall.} = + echo("TEST") + +proc initProcess(): void = + echo("In initProcess()") + var thread: Thread[void] + createThread(thread, whatever) + echo("initProcess() done") + joinThread(thread) + +proc doStuff(): void = + echo("In doStuff()") + # ... + initProcess() + sleep(500) + # ... + echo("Crashes before getting here!") + +doStuff() |