diff options
author | metagn <10591326+metagn@users.noreply.github.com> | 2022-07-12 19:03:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-12 18:03:58 +0200 |
commit | 5c510a9ab96f265ffb0323a18deadb5bb175cfdc (patch) | |
tree | c8d72c0ea6d6d5cd5556549ca8623cf2be728d99 /tests | |
parent | a97b00ad8d18d836d693c224909b607d2af0c4b1 (diff) | |
download | Nim-5c510a9ab96f265ffb0323a18deadb5bb175cfdc.tar.gz |
allow dots in defined() (#20010)
* allow dots in defined() refs https://github.com/nim-lang/RFCs/issues/181 * mention accents in older versions
Diffstat (limited to 'tests')
-rw-r--r-- | tests/misc/tdefine.nim | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/misc/tdefine.nim b/tests/misc/tdefine.nim index f1c6e7a96..c4d11c941 100644 --- a/tests/misc/tdefine.nim +++ b/tests/misc/tdefine.nim @@ -1,6 +1,6 @@ discard """ joinable: false -cmd: "nim c -d:booldef -d:booldef2=false -d:intdef=2 -d:strdef=foobar -r $file" +cmd: "nim c -d:booldef -d:booldef2=false -d:intdef=2 -d:strdef=foobar -d:namespaced.define=false -d:double.namespaced.define -r $file" """ const booldef {.booldefine.} = false @@ -27,4 +27,19 @@ type T = object when intdef2 == 1: field2: int when strdef2 == "abc": - field3: int \ No newline at end of file + field3: int + +doAssert not defined(booldef3) +doAssert not defined(intdef2) +doAssert not defined(strdef2) +discard T(field1: 1, field2: 2, field3: 3) + +doAssert defined(namespaced.define) +const `namespaced.define` {.booldefine.} = true +doAssert not `namespaced.define` + +doAssert defined(double.namespaced.define) +const `double.namespaced.define` {.booldefine.} = false +doAssert `double.namespaced.define` + +doAssert not defined(namespaced.butnotdefined) |