summary refs log tree commit diff stats
path: root/tests/modules/tcanimport.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/modules/tcanimport.nim')
-rw-r--r--tests/modules/tcanimport.nim19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/modules/tcanimport.nim b/tests/modules/tcanimport.nim
new file mode 100644
index 000000000..bc4e2e53f
--- /dev/null
+++ b/tests/modules/tcanimport.nim
@@ -0,0 +1,19 @@
+discard """
+  output: '''ABC
+nope'''
+"""
+
+template canImport(x): bool =
+  compiles:
+    import x
+
+when canImport(strutils):
+  import strutils
+  echo "abc".toUpperAscii
+else:
+  echo "meh"
+
+when canImport(none):
+  echo "what"
+else:
+  echo "nope"