Skip to content

Commit

Permalink
add tests for nim-lang#15584 (nim-lang#15619)
Browse files Browse the repository at this point in the history
* add test for nim-lang#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
  • Loading branch information
n5m authored and mildred committed Jan 11, 2021
1 parent 18d26f1 commit 4c02f7b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/stdlib/trlocks.nim
Original file line number Diff line number Diff line change
@@ -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 changes: 13 additions & 0 deletions tests/stdlib/tuserlocks.nim
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 4c02f7b

Please sign in to comment.