mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-03 11:42:33 +00:00
* add test for #15584
* Rename userlocks.nim to trlocks.nim
* add bug comment
* improve cmd
* reference bugfix, not bug
* add test that runs rlocks
* disallow joining
joining with other test cases (e.g., a test case that invokes `RLock.initRLock()`) may cause this test to compile, when the goal is to test if these lines can be compiled in isolation
(cherry picked from commit 78cbb52fa0)
This commit is contained in:
14
tests/stdlib/trlocks.nim
Normal file
14
tests/stdlib/trlocks.nim
Normal file
@@ -0,0 +1,14 @@
|
||||
discard """
|
||||
action: "compile"
|
||||
# Disallow joining to ensure it can compile in isolation.
|
||||
# See #15584
|
||||
joinable: false
|
||||
cmd: "nim $target --threads:on $options $file"
|
||||
"""
|
||||
|
||||
# bugfix #15584
|
||||
|
||||
import rlocks
|
||||
|
||||
var r: RLock
|
||||
r.initRLock()
|
||||
13
tests/stdlib/tuserlocks.nim
Normal file
13
tests/stdlib/tuserlocks.nim
Normal file
@@ -0,0 +1,13 @@
|
||||
discard """
|
||||
cmd: "nim $target --threads:on $options $file"
|
||||
"""
|
||||
|
||||
import rlocks
|
||||
|
||||
var r: RLock
|
||||
r.initRLock()
|
||||
doAssert r.tryAcquire()
|
||||
doAssert r.tryAcquire()
|
||||
r.release()
|
||||
r.release()
|
||||
r.deinitRLock()
|
||||
Reference in New Issue
Block a user