-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix corner case with custom pragma (#42)
The AST changes when you call the same custom pragma more than once.
- Loading branch information
1 parent
585059d
commit 9826fdd
Showing
3 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import | ||
std/unittest, | ||
../confutils, | ||
../confutils/defs | ||
|
||
{.pragma: customPragma, hidden.} | ||
|
||
type | ||
TestConf* = object | ||
statusBarEnabled* {. | ||
customPragma | ||
desc: "Display a status bar at the bottom of the terminal screen" | ||
defaultValue: true | ||
name: "status-bar" }: bool | ||
|
||
statusBarEnabled2* {. | ||
customPragma | ||
desc: "Display a status bar at the bottom of the terminal screen" | ||
defaultValue: true | ||
name: "status-bar2" }: bool | ||
|
||
suite "test custom pragma": | ||
test "funny AST when called twice": | ||
let conf = TestConf.load() | ||
doAssert(conf.statusBarEnabled == true) | ||
doAssert(conf.statusBarEnabled2 == true) | ||
|