Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ringabout committed Feb 24, 2021
1 parent b18bc7e commit b81a987
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/pure/unittest.nim
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,8 @@ macro check*(conditions: untyped): untyped =
check:
"AKB48".toLowerAscii() == "akb48"
'C' notin teams
let checked = conditions

let checked = callsite()[1]

template asgn(a: untyped, value: typed) =
var a = value # XXX: we need "var: var" here in order to
Expand Down
23 changes: 18 additions & 5 deletions tests/stdlib/tunittest.nim
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ discard """
targets: "c js"
"""

import unittest, sequtils
import std/[unittest, sequtils]

proc doThings(spuds: var int): int =
spuds = 24
Expand All @@ -33,12 +33,12 @@ test "#964":
check spuds == 24


from strutils import toUpperAscii
from std/strutils import toUpperAscii
test "#1384":
check(@["hello", "world"].map(toUpperAscii) == @["HELLO", "WORLD"])


import options
import std/options
test "unittest typedescs":
check(none(int) == none(int))
check(none(int) != some(1))
Expand All @@ -49,8 +49,8 @@ test "unittest multiple requires":
require(true)


import random
from strutils import parseInt
import std/random
from std/strutils import parseInt
proc defectiveRobot() =
case rand(1..4)
of 1: raise newException(OSError, "CANNOT COMPUTE!")
Expand Down Expand Up @@ -177,3 +177,16 @@ suite "test name filtering":
check false == matchFilter("suite1", "foo", "*ite2::")
check matchFilter("suite1", "q**we::foo", "q**we::foo")
check matchFilter("suite1", "a::b*c::d*e", "a::b*c::d*e")


block:
type MyFoo = object
var obj = MyFoo()
let check = 1
check(obj == obj)

block:
let check = 123
var a = 1
var b = 1
check(a == b)

0 comments on commit b81a987

Please sign in to comment.