summary refs log tree commit diff stats
path: root/tests/pragmas
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-04-14 12:22:22 -0700
committerGitHub <noreply@github.com>2021-04-14 21:22:22 +0200
commitd6242d7fe19849d6cc7079f0b006065fb2a8a19e (patch)
tree3b6654d930d23e6e70ae2907e68503641ec738a1 /tests/pragmas
parent56c37759d6183aa32d474e669de618ee9c4f7633 (diff)
downloadNim-d6242d7fe19849d6cc7079f0b006065fb2a8a19e.tar.gz
simplify asyncfutures, asyncmacro (#17633)
Diffstat (limited to 'tests/pragmas')
-rw-r--r--tests/pragmas/tcustom_pragma.nim20
1 files changed, 7 insertions, 13 deletions
diff --git a/tests/pragmas/tcustom_pragma.nim b/tests/pragmas/tcustom_pragma.nim
index 5342b78e6..55761d107 100644
--- a/tests/pragmas/tcustom_pragma.nim
+++ b/tests/pragmas/tcustom_pragma.nim
@@ -262,6 +262,10 @@ block:
     doAssert input.treeRepr & "\n" == expectedRepr
     return input
 
+  macro expectedAstRepr(expectedRepr: static[string], input: untyped): untyped =
+    doAssert input.repr == expectedRepr
+    return input
+
   const procTypeAst = """
 ProcTy
   FormalParams
@@ -280,20 +284,10 @@ ProcTy
   static: doAssert Foo is proc(x: int): Future[void]
 
   const asyncProcTypeAst = """
-ProcTy
-  FormalParams
-    BracketExpr
-      Ident "Future"
-      Ident "void"
-    IdentDefs
-      Ident "s"
-      Ident "string"
-      Empty
-  Pragma
-"""
-
+proc (s: string): Future[void] {..}"""
+  # using expectedAst would show `OpenSymChoice` for Future[void], which is fragile.
   type
-    Bar = proc (s: string) {.async, expectedAst(asyncProcTypeAst).}
+    Bar = proc (s: string) {.async, expectedAstRepr(asyncProcTypeAst).}
 
   static: doAssert Bar is proc(x: string): Future[void]