summary refs log tree commit diff stats
path: root/tests/macros
diff options
context:
space:
mode:
Diffstat (limited to 'tests/macros')
-rw-r--r--tests/macros/tmacrotypes.nim14
-rw-r--r--tests/macros/tnimnode_for_runtime.nim (renamed from tests/macros/tnimrodnode_for_runtime.nim)1
-rw-r--r--tests/macros/tsame_name_497.nim4
-rw-r--r--tests/macros/typesapi.nim17
4 files changed, 28 insertions, 8 deletions
diff --git a/tests/macros/tmacrotypes.nim b/tests/macros/tmacrotypes.nim
index f19aa2ddb..991668930 100644
--- a/tests/macros/tmacrotypes.nim
+++ b/tests/macros/tmacrotypes.nim
@@ -1,16 +1,16 @@
 discard """
-  disabled: true
+  nimout: '''void
+int'''
 """
 
-import macros, typetraits
+import macros
 
-macro checkType(ex, expected: expr): stmt {.immediate.} =
-  var t = ex.typ
-  assert t.name == expected.strVal
+macro checkType(ex: stmt; expected: expr): stmt =
+  var t = ex.getType()
+  echo t
 
 proc voidProc = echo "hello"
-proc intProc(a, b): int = 10
+proc intProc(a: int, b: float): int = 10
 
 checkType(voidProc(), "void")
 checkType(intProc(10, 20.0), "int")
-checkType(noproc(10, 20.0), "Error Type")
diff --git a/tests/macros/tnimrodnode_for_runtime.nim b/tests/macros/tnimnode_for_runtime.nim
index e73c8430f..69c7aedd2 100644
--- a/tests/macros/tnimrodnode_for_runtime.nim
+++ b/tests/macros/tnimnode_for_runtime.nim
@@ -1,6 +1,5 @@
 discard """
   output: "bla"
-  disabled: true
 """
 
 import macros
diff --git a/tests/macros/tsame_name_497.nim b/tests/macros/tsame_name_497.nim
index e49f9f6d8..ed5d5c6d8 100644
--- a/tests/macros/tsame_name_497.nim
+++ b/tests/macros/tsame_name_497.nim
@@ -1,3 +1,7 @@
+discard """
+  disabled: true
+"""
+
 import macro_bug
 
 type TObj = object
diff --git a/tests/macros/typesapi.nim b/tests/macros/typesapi.nim
new file mode 100644
index 000000000..670b39c9e
--- /dev/null
+++ b/tests/macros/typesapi.nim
@@ -0,0 +1,17 @@
+discard """
+  nimout: '''proc (x: int): string => typeDesc[proc[string, int]]
+proc (x: int): void => typeDesc[proc[void, int]]
+proc (x: int) => typeDesc[proc[void, int]]'''
+"""
+
+#2211
+
+import macros
+
+macro showType(t:stmt): stmt =
+  let ty = t.getType
+  echo t.repr, " => ", ty.repr
+
+showType(proc(x:int): string)
+showType(proc(x:int): void)
+showType(proc(x:int))