diff options
Diffstat (limited to 'tests/stdlib')
-rw-r--r-- | tests/stdlib/nre/captures.nim | 6 | ||||
-rw-r--r-- | tests/stdlib/nre/replace.nim | 4 | ||||
-rw-r--r-- | tests/stdlib/tjsonmacro.nim | 4 | ||||
-rw-r--r-- | tests/stdlib/tnilecho.nim | 8 |
4 files changed, 13 insertions, 9 deletions
diff --git a/tests/stdlib/nre/captures.nim b/tests/stdlib/nre/captures.nim index 19c344a8d..31de71154 100644 --- a/tests/stdlib/nre/captures.nim +++ b/tests/stdlib/nre/captures.nim @@ -27,7 +27,7 @@ suite "captures": let ex2 = "foo".find(re("(?<foo>foo)(?<bar>bar)?")) check(ex2.captures["foo"] == "foo") - check(ex2.captures["bar"] == nil) + check(ex2.captures["bar"] == "") test "named capture bounds": let ex1 = "foo".find(re("(?<foo>foo)(?<bar>bar)?")) @@ -41,7 +41,7 @@ suite "captures": test "named capture table": let ex1 = "foo".find(re("(?<foo>foo)(?<bar>bar)?")) - check(ex1.captures.toTable == {"foo" : "foo", "bar" : nil}.toTable()) + check(ex1.captures.toTable == {"foo" : "foo", "bar" : ""}.toTable()) check(ex1.captureBounds.toTable == {"foo" : some(0..2), "bar" : none(Slice[int])}.toTable()) check(ex1.captures.toTable("") == {"foo" : "foo", "bar" : ""}.toTable()) @@ -50,7 +50,7 @@ suite "captures": test "capture sequence": let ex1 = "foo".find(re("(?<foo>foo)(?<bar>bar)?")) - check(ex1.captures.toSeq == @["foo", nil]) + check(ex1.captures.toSeq == @["foo", ""]) check(ex1.captureBounds.toSeq == @[some(0..2), none(Slice[int])]) check(ex1.captures.toSeq("") == @["foo", ""]) diff --git a/tests/stdlib/nre/replace.nim b/tests/stdlib/nre/replace.nim index 516fd4328..b762271a2 100644 --- a/tests/stdlib/nre/replace.nim +++ b/tests/stdlib/nre/replace.nim @@ -16,5 +16,5 @@ suite "replace": check("123".replace(re"(?<foo>\d)(\d)", "${foo}$#$#") == "1123") test "replacing missing captures should throw instead of segfaulting": - expect ValueError: discard "ab".replace(re"(a)|(b)", "$1$2") - expect ValueError: discard "b".replace(re"(a)?(b)", "$1$2") + discard "ab".replace(re"(a)|(b)", "$1$2") + discard "b".replace(re"(a)?(b)", "$1$2") diff --git a/tests/stdlib/tjsonmacro.nim b/tests/stdlib/tjsonmacro.nim index c0b4d5f78..bf0bb3ea7 100644 --- a/tests/stdlib/tjsonmacro.nim +++ b/tests/stdlib/tjsonmacro.nim @@ -40,7 +40,7 @@ when isMainModule: test: 18827361, test2: "hello world", test3: true, - testNil: nil + testNil: "nil" ) let node = %x @@ -53,7 +53,7 @@ when isMainModule: doAssert y.test == 18827361 doAssert y.test2 == "hello world" doAssert y.test3 - doAssert y.testNil.isNil + doAssert y.testNil == "nil" # Test for custom object variants (without an enum) and with an else branch. block: diff --git a/tests/stdlib/tnilecho.nim b/tests/stdlib/tnilecho.nim index 147b5e492..ec8d71dab 100644 --- a/tests/stdlib/tnilecho.nim +++ b/tests/stdlib/tnilecho.nim @@ -1,2 +1,6 @@ -var x = @["1", nil, "3"] -doAssert $x == "@[1, nil, 3]" +discard """ + output: "" +""" + +var x = @["1", "", "3"] +doAssert $x == """@["1", "", "3"]""" |