summary refs log tree commit diff stats
path: root/tests/tools/tunused_imports.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tools/tunused_imports.nim')
-rw-r--r--tests/tools/tunused_imports.nim41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/tools/tunused_imports.nim b/tests/tools/tunused_imports.nim
new file mode 100644
index 000000000..539608ad6
--- /dev/null
+++ b/tests/tools/tunused_imports.nim
@@ -0,0 +1,41 @@
+discard """
+  cmd: '''nim c --hint:Processing:off $file'''
+  nimout: '''
+tunused_imports.nim(14, 10) Warning: BEGIN [User]
+tunused_imports.nim(41, 10) Warning: END [User]
+tunused_imports.nim(37, 8) Warning: imported and not used: 'strutils' [UnusedImport]
+tunused_imports.nim(38, 13) Warning: imported and not used: 'strtabs' [UnusedImport]
+tunused_imports.nim(38, 22) Warning: imported and not used: 'cstrutils' [UnusedImport]
+tunused_imports.nim(39, 12) Warning: imported and not used: 'macrocache' [UnusedImport]
+'''
+  action: "compile"
+"""
+
+{.warning: "BEGIN".}
+
+# bug #12885
+
+import tables, second
+
+template test(key: int): untyped =
+  `[]`(dataEx, key)
+
+echo test(1)
+
+import net, dontmentionme
+
+echo AF_UNIX
+
+import macros
+# bug #11809
+macro bar(): untyped =
+  template baz() = discard
+  result = getAst(baz())
+
+bar()
+
+import strutils
+import std/[strtabs, cstrutils]
+import std/macrocache
+
+{.warning: "END".}