summary refs log tree commit diff stats
path: root/tests/pragmas
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2020-05-25 02:17:25 -0700
committerGitHub <noreply@github.com>2020-05-25 11:17:25 +0200
commita008f591e2b318c2c9e12b8923210435d22e8280 (patch)
treedb778c7abf34db0eef20a16e71ffeb0abf7b8a09 /tests/pragmas
parentacae3b02c7d3b7d916430223c5a2948e68d83ea4 (diff)
downloadNim-a008f591e2b318c2c9e12b8923210435d22e8280.tar.gz
add test for `define`, `undef` (#14443)
Diffstat (limited to 'tests/pragmas')
-rw-r--r--tests/pragmas/tpragmas_misc.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/pragmas/tpragmas_misc.nim b/tests/pragmas/tpragmas_misc.nim
new file mode 100644
index 000000000..247fa471e
--- /dev/null
+++ b/tests/pragmas/tpragmas_misc.nim
@@ -0,0 +1,12 @@
+##[
+tests for misc pragmas that don't need a separate file
+]##
+
+block:
+  static: doAssert not defined(tpragmas_misc_def)
+  {.undef(tpragmas_misc_def).} # works even if not set
+  static: doAssert not defined(tpragmas_misc_def)
+  {.define(tpragmas_misc_def).}
+  static: doAssert defined(tpragmas_misc_def)
+  {.undef(tpragmas_misc_def).}
+  static: doAssert not defined(tpragmas_misc_def)