make the 'canimport' template work

This commit is contained in:
Andreas Rumpf 2018-03-06 15:57:39 +01:00
commit eeea000582
2 changed files with 27 additions and 1 deletions

View file

@ -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"