mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-05 04:27:44 +00:00
@@ -631,7 +631,7 @@ macro check*(conditions: untyped): untyped =
|
||||
|
||||
var counter = 0
|
||||
|
||||
if exp[0].kind == nnkIdent and
|
||||
if exp[0].kind in {nnkIdent, nnkOpenSymChoice, nnkClosedSymChoice, nnkSym} and
|
||||
$exp[0] in ["not", "in", "notin", "==", "<=",
|
||||
">=", "<", ">", "!=", "is", "isnot"]:
|
||||
|
||||
|
||||
25
tests/stdlib/tunittesttemplate.nim
Normal file
25
tests/stdlib/tunittesttemplate.nim
Normal file
@@ -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()
|
||||
Reference in New Issue
Block a user