diff options
author | Flaviu Tamas <tamasflaviu@gmail.com> | 2018-11-18 20:25:59 -0500 |
---|---|---|
committer | Flaviu Tamas <tamasflaviu@gmail.com> | 2018-12-11 22:15:02 +0000 |
commit | 22b3e9df27fc65ec49b8ba8ea8de492917988e3d (patch) | |
tree | 96e6a2ccb032be0945687f3927dd5eb98380f54a /tests/stdlib | |
parent | c682671feae3ae6c90416152f84b274cb5aa4a21 (diff) | |
download | Nim-22b3e9df27fc65ec49b8ba8ea8de492917988e3d.tar.gz |
Revert 7f49364fd0 for nre
Diffstat (limited to 'tests/stdlib')
-rw-r--r-- | tests/stdlib/nre/captures.nim | 6 | ||||
-rw-r--r-- | tests/stdlib/nre/replace.nim | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/tests/stdlib/nre/captures.nim b/tests/stdlib/nre/captures.nim index 31de71154..19c344a8d 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"] == "") + check(ex2.captures["bar"] == nil) 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" : ""}.toTable()) + check(ex1.captures.toTable == {"foo" : "foo", "bar" : nil}.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", ""]) + check(ex1.captures.toSeq == @["foo", nil]) 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 b762271a2..516fd4328 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": - discard "ab".replace(re"(a)|(b)", "$1$2") - discard "b".replace(re"(a)?(b)", "$1$2") + expect ValueError: discard "ab".replace(re"(a)|(b)", "$1$2") + expect ValueError: discard "b".replace(re"(a)?(b)", "$1$2") |