summary refs log tree commit diff stats
path: root/tests/deprecated
diff options
context:
space:
mode:
Diffstat (limited to 'tests/deprecated')
-rw-r--r--tests/deprecated/importme.nim10
-rw-r--r--tests/deprecated/tmodule1.nim23
-rw-r--r--tests/deprecated/tnoannot.nim7
3 files changed, 40 insertions, 0 deletions
diff --git a/tests/deprecated/importme.nim b/tests/deprecated/importme.nim
new file mode 100644
index 000000000..0a9c6e37d
--- /dev/null
+++ b/tests/deprecated/importme.nim
@@ -0,0 +1,10 @@
+type
+  Ty* {.deprecated.} = uint32
+  Ty1* {.deprecated: "hello".} = uint32
+
+var aVar* {.deprecated.}: char
+
+proc aProc*() {.deprecated.} = discard
+proc aProc1*() {.deprecated: "hello".} = discard
+
+{.deprecated: "goodbye".}
diff --git a/tests/deprecated/tmodule1.nim b/tests/deprecated/tmodule1.nim
new file mode 100644
index 000000000..954836889
--- /dev/null
+++ b/tests/deprecated/tmodule1.nim
@@ -0,0 +1,23 @@
+discard """
+  nimout: '''tmodule1.nim(11, 8) Warning: goodbye; importme is deprecated [Deprecated]
+tmodule1.nim(14, 10) Warning: Ty is deprecated [Deprecated]
+tmodule1.nim(17, 10) Warning: hello; Ty1 is deprecated [Deprecated]
+tmodule1.nim(20, 8) Warning: aVar is deprecated [Deprecated]
+tmodule1.nim(22, 3) Warning: aProc is deprecated [Deprecated]
+tmodule1.nim(23, 3) Warning: hello; aProc1 is deprecated [Deprecated]
+'''
+"""
+
+import importme
+
+block:
+  var z: Ty
+  z = 0
+block:
+  var z: Ty1
+  z = 0
+block:
+  echo aVar
+block:
+  aProc()
+  aProc1()
diff --git a/tests/deprecated/tnoannot.nim b/tests/deprecated/tnoannot.nim
new file mode 100644
index 000000000..9cc5c7e06
--- /dev/null
+++ b/tests/deprecated/tnoannot.nim
@@ -0,0 +1,7 @@
+discard """
+  line: 7
+  errormsg: "annotation to deprecated not supported here"
+"""
+
+var foo* {.deprecated.} = 42
+var foo1* {.deprecated: "no".} = 42