mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 22:10:33 +00:00
Merge pull request #6725 from FedericoCeratto/unittest-5114
Add unittest suite/test name filters
This commit is contained in:
@@ -13,6 +13,8 @@ discard """
|
||||
|
||||
[Suite] bug #5784
|
||||
|
||||
[Suite] test name filtering
|
||||
|
||||
'''
|
||||
"""
|
||||
|
||||
@@ -120,3 +122,39 @@ suite "bug #5784":
|
||||
field: int
|
||||
var obj: Obj
|
||||
check obj.isNil or obj.field == 0
|
||||
|
||||
when defined(testing):
|
||||
suite "test name filtering":
|
||||
test "test name":
|
||||
check matchFilter("suite1", "foo", "")
|
||||
check matchFilter("suite1", "foo", "foo")
|
||||
check matchFilter("suite1", "foo", "::")
|
||||
check matchFilter("suite1", "foo", "*")
|
||||
check matchFilter("suite1", "foo", "::foo")
|
||||
check matchFilter("suite1", "::foo", "::foo")
|
||||
|
||||
test "test name - glob":
|
||||
check matchFilter("suite1", "foo", "f*")
|
||||
check matchFilter("suite1", "foo", "*oo")
|
||||
check matchFilter("suite1", "12345", "12*345")
|
||||
check matchFilter("suite1", "q*wefoo", "q*wefoo")
|
||||
check false == matchFilter("suite1", "foo", "::x")
|
||||
check false == matchFilter("suite1", "foo", "::x*")
|
||||
check false == matchFilter("suite1", "foo", "::*x")
|
||||
# overlap
|
||||
check false == matchFilter("suite1", "12345", "123*345")
|
||||
check matchFilter("suite1", "ab*c::d*e::f", "ab*c::d*e::f")
|
||||
|
||||
test "suite name":
|
||||
check matchFilter("suite1", "foo", "suite1::")
|
||||
check false == matchFilter("suite1", "foo", "suite2::")
|
||||
check matchFilter("suite1", "qwe::foo", "qwe::foo")
|
||||
check matchFilter("suite1", "qwe::foo", "suite1::qwe::foo")
|
||||
|
||||
test "suite name - glob":
|
||||
check matchFilter("suite1", "foo", "::*")
|
||||
check matchFilter("suite1", "foo", "*::*")
|
||||
check matchFilter("suite1", "foo", "*::foo")
|
||||
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")
|
||||
|
||||
Reference in New Issue
Block a user