summary refs log tree commit diff stats
path: root/tests/stdlib/tunittesttemplate.nim
diff options
context:
space:
mode:
authorMiran <narimiran@disroot.org>2020-02-07 22:04:08 +0100
committerGitHub <noreply@github.com>2020-02-07 22:04:08 +0100
commitf3117d350ea245769d60a80b2d12b062cff4b8ff (patch)
tree805ddf0c96d36d4f7797d77819ef975314dd8b6b /tests/stdlib/tunittesttemplate.nim
parent78b15de3044feb4ac08fd5784714fac4d470e82b (diff)
downloadNim-f3117d350ea245769d60a80b2d12b062cff4b8ff.tar.gz
fix #6736: templates in unittest now show actual value (#13354)
Diffstat (limited to 'tests/stdlib/tunittesttemplate.nim')
-rw-r--r--tests/stdlib/tunittesttemplate.nim25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/stdlib/tunittesttemplate.nim b/tests/stdlib/tunittesttemplate.nim
new file mode 100644
index 000000000..5ac323a36
--- /dev/null
+++ b/tests/stdlib/tunittesttemplate.nim
@@ -0,0 +1,25 @@
+discard """
+  exitcode: 1
+  outputsub: '''
+    tunittesttemplate.nim(20, 12): Check failed: a.b ==
+    2
+    a.b was 0
+  [FAILED] 1
+'''
+"""
+
+# bug #6736
+
+import unittest
+
+type
+  A = object
+    b: int
+
+template t: untyped =
+  check(a.b == 2)
+
+suite "1":
+  test "1":
+    var a = A(b: 0)
+    t()