summary refs log tree commit diff stats
path: root/tests/template/utemplates.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/template/utemplates.nim')
-rw-r--r--tests/template/utemplates.nim21
1 files changed, 13 insertions, 8 deletions
diff --git a/tests/template/utemplates.nim b/tests/template/utemplates.nim
index 199268046..d70746578 100644
--- a/tests/template/utemplates.nim
+++ b/tests/template/utemplates.nim
@@ -3,11 +3,11 @@ import unittest
 template t(a: int): string = "int"
 template t(a: string): string = "string"
 
-test "templates can be overloaded":
+block: # templates can be overloaded
   check t(10) == "int"
   check t("test") == "string"
 
-test "previous definitions can be further overloaded or hidden in local scopes":
+block: # previous definitions can be further overloaded or hidden in local scopes
   template t(a: bool): string = "bool"
 
   check t(true) == "bool"
@@ -17,15 +17,20 @@ test "previous definitions can be further overloaded or hidden in local scopes":
   check t(10) == "inner int"
   check t("test") == "string"
 
-test "templates can be redefined multiple times":
-  template customAssert(cond: bool, msg: string): typed {.immediate, dirty.} =
+block: # templates can be redefined multiple times
+  template customAssert(cond: bool, msg: string): typed {.dirty.} =
     if not cond: fail(msg)
 
-  template assertion_failed(body: typed) {.immediate, dirty.} =
-    template fail(msg: string): typed = body
+  template assertionFailed(body: untyped) {.dirty.} =
+    template fail(msg: string): typed {.redefine.} =
+      body
+
+  assertionFailed:
+    check(msg == "first fail path")
 
-  assertion_failed: check msg == "first fail path"
   customAssert false, "first fail path"
 
-  assertion_failed: check msg == "second fail path"
+  assertionFailed:
+    check(msg == "second fail path")
+
   customAssert false, "second fail path"