summary refs log tree commit diff stats
path: root/tests/stdlib/nre
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2020-12-27 07:45:57 -0600
committerGitHub <noreply@github.com>2020-12-27 14:45:57 +0100
commit271f68259b5c42f515a707cd51bd500a298ec4a0 (patch)
tree2344b4534bbc3821cb295c244ee9f1e4746dcc41 /tests/stdlib/nre
parent357729639ff970ba934a0dea2ae06ff063e37910 (diff)
downloadNim-271f68259b5c42f515a707cd51bd500a298ec4a0.tar.gz
remove some noises in tests (#16448)
Diffstat (limited to 'tests/stdlib/nre')
-rw-r--r--tests/stdlib/nre/captures.nim16
-rw-r--r--tests/stdlib/nre/escape.nim4
-rw-r--r--tests/stdlib/nre/find.nim12
-rw-r--r--tests/stdlib/nre/init.nim10
-rw-r--r--tests/stdlib/nre/match.nim8
-rw-r--r--tests/stdlib/nre/misc.nim6
-rw-r--r--tests/stdlib/nre/replace.nim8
-rw-r--r--tests/stdlib/nre/split.nim14
8 files changed, 39 insertions, 39 deletions
diff --git a/tests/stdlib/nre/captures.nim b/tests/stdlib/nre/captures.nim
index bd5e83ecc..acc141baf 100644
--- a/tests/stdlib/nre/captures.nim
+++ b/tests/stdlib/nre/captures.nim
@@ -1,12 +1,12 @@
 import unittest, optional_nonstrict
 include nre
 
-suite "captures":
-  test "map capture names to numbers":
+block: # captures
+  block: # map capture names to numbers
     check(getNameToNumberTable(re("(?<v1>1(?<v2>2(?<v3>3))(?'v4'4))()")) ==
       { "v1" : 0, "v2" : 1, "v3" : 2, "v4" : 3 }.toTable())
 
-  test "capture bounds are correct":
+  block: # capture bounds are correct
     let ex1 = re("([0-9])")
     check("1 23".find(ex1).matchBounds == 0 .. 0)
     check("1 23".find(ex1).captureBounds[0] == 0 .. 0)
@@ -20,7 +20,7 @@ suite "captures":
     let ex3 = re("([0-9]+)")
     check("824".find(ex3).captureBounds[0] == 0 .. 2)
 
-  test "named captures":
+  block: # named captures
     let ex1 = "foobar".find(re("(?<foo>foo)(?<bar>bar)"))
     check(ex1.captures["foo"] == "foo")
     check(ex1.captures["bar"] == "bar")
@@ -32,7 +32,7 @@ suite "captures":
     expect KeyError:
         discard ex2.captures["bar"]
 
-  test "named capture bounds":
+  block: # named capture bounds
     let ex1 = "foo".find(re("(?<foo>foo)(?<bar>bar)?"))
     check("foo" in ex1.captureBounds)
     check(ex1.captureBounds["foo"] == 0..2)
@@ -40,12 +40,12 @@ suite "captures":
     expect KeyError:
         discard ex1.captures["bar"]
 
-  test "capture count":
+  block: # capture count
     let ex1 = re("(?<foo>foo)(?<bar>bar)?")
     check(ex1.captureCount == 2)
     check(ex1.captureNameId == {"foo" : 0, "bar" : 1}.toTable())
 
-  test "named capture table":
+  block: # named capture table
     let ex1 = "foo".find(re("(?<foo>foo)(?<bar>bar)?"))
     check(ex1.captures.toTable == {"foo" : "foo"}.toTable())
     check(ex1.captureBounds.toTable == {"foo" : 0..2}.toTable())
@@ -53,7 +53,7 @@ suite "captures":
     let ex2 = "foobar".find(re("(?<foo>foo)(?<bar>bar)?"))
     check(ex2.captures.toTable == {"foo" : "foo", "bar" : "bar"}.toTable())
 
-  test "capture sequence":
+  block: # capture sequence
     let ex1 = "foo".find(re("(?<foo>foo)(?<bar>bar)?"))
     check(ex1.captures.toSeq == @[some("foo"), none(string)])
     check(ex1.captureBounds.toSeq == @[some(0..2), none(Slice[int])])
diff --git a/tests/stdlib/nre/escape.nim b/tests/stdlib/nre/escape.nim
index db5e8a001..5e7dc0c0e 100644
--- a/tests/stdlib/nre/escape.nim
+++ b/tests/stdlib/nre/escape.nim
@@ -1,7 +1,7 @@
 import nre, unittest
 
-suite "escape strings":
-  test "escape strings":
+block: # escape strings
+  block: # escape strings
     check("123".escapeRe() == "123")
     check("[]".escapeRe() == r"\[\]")
     check("()".escapeRe() == r"\(\)")
diff --git a/tests/stdlib/nre/find.nim b/tests/stdlib/nre/find.nim
index caa953ff4..7e7555d73 100644
--- a/tests/stdlib/nre/find.nim
+++ b/tests/stdlib/nre/find.nim
@@ -3,23 +3,23 @@ import nre except toSeq
 import optional_nonstrict
 import times, strutils
 
-suite "find":
-  test "find text":
+block: # find
+  block: # find text
     check("3213a".find(re"[a-z]").match == "a")
     check(toSeq(findIter("1 2 3 4 5 6 7 8 ", re" ")).map(
       proc (a: RegexMatch): string = a.match
     ) == @[" ", " ", " ", " ", " ", " ", " ", " "])
 
-  test "find bounds":
+  block: # find bounds
     check(toSeq(findIter("1 2 3 4 5 ", re" ")).map(
       proc (a: RegexMatch): Slice[int] = a.matchBounds
     ) == @[1..1, 3..3, 5..5, 7..7, 9..9])
 
-  test "overlapping find":
+  block: # overlapping find
     check("222".findAll(re"22") == @["22"])
     check("2222".findAll(re"22") == @["22", "22"])
 
-  test "len 0 find":
+  block: # len 0 find
     check("".findAll(re"\ ") == newSeq[string]())
     check("".findAll(re"") == @[""])
     check("abc".findAll(re"") == @["", "", "", ""])
@@ -27,7 +27,7 @@ suite "find":
     check("word\r\lword".findAll(re"(*ANYCRLF)(?m)$") == @["", ""])
     check("слово слово".findAll(re"(*U)\b") == @["", "", "", ""])
 
-  test "bail early":
+  block: # bail early
     ## we expect nothing to be found and we should be bailing out early which means that
     ## the timing difference between searching in small and large data should be well
     ## within a tolerance margin
diff --git a/tests/stdlib/nre/init.nim b/tests/stdlib/nre/init.nim
index 26e668104..f0c8e0a00 100644
--- a/tests/stdlib/nre/init.nim
+++ b/tests/stdlib/nre/init.nim
@@ -1,12 +1,12 @@
 import unittest
 include nre
 
-suite "Test NRE initialization":
-  test "correct initialization":
+block: # Test NRE initialization
+  block: # correct initialization
     check(re("[0-9]+") != nil)
     check(re("(?i)[0-9]+") != nil)
 
-  test "options":
+  block: # options
     check(extractOptions("(*NEVER_UTF)") ==
           ("", pcre.NEVER_UTF, true))
     check(extractOptions("(*UTF8)(*ANCHORED)(*UCP)z") ==
@@ -19,14 +19,14 @@ suite "Test NRE initialization":
     check(extractOptions("(*LIMIT_MATCH=6)(*ANCHORED)z") ==
           ("(*LIMIT_MATCH=6)z", pcre.ANCHORED, true))
 
-  test "incorrect options":
+  block: # incorrect options
     for s in ["CR", "(CR", "(*CR", "(*abc)", "(*abc)CR",
               "(?i)",
               "(*LIMIT_MATCH=5", "(*NO_AUTO_POSSESS=5)"]:
       let ss = s & "(*NEVER_UTF)"
       check(extractOptions(ss) == (ss, 0, true))
 
-  test "invalid regex":
+  block: # invalid regex
     expect(SyntaxError): discard re("[0-9")
     try:
       discard re("[0-9")
diff --git a/tests/stdlib/nre/match.nim b/tests/stdlib/nre/match.nim
index 06b69fd04..7e09a4b2f 100644
--- a/tests/stdlib/nre/match.nim
+++ b/tests/stdlib/nre/match.nim
@@ -1,12 +1,12 @@
 include nre, unittest, optional_nonstrict
 
-suite "match":
-  test "upper bound must be inclusive":
+block: # match
+  block: # upper bound must be inclusive
     check("abc".match(re"abc", endpos = -1) == none(RegexMatch))
     check("abc".match(re"abc", endpos = 1) == none(RegexMatch))
     check("abc".match(re"abc", endpos = 2) != none(RegexMatch))
 
-  test "match examples":
+  block: # match examples
     check("abc".match(re"(\w)").captures[0] == "a")
     check("abc".match(re"(?<letter>\w)").captures["letter"] == "a")
     check("abc".match(re"(\w)\w").captures[-1] == "ab")
@@ -14,5 +14,5 @@ suite "match":
     check("abc".match(re"").captureBounds[-1] == 0 .. -1)
     check("abc".match(re"abc").captureBounds[-1] == 0 .. 2)
 
-  test "match test cases":
+  block: # match test cases
     check("123".match(re"").matchBounds == 0 .. -1)
diff --git a/tests/stdlib/nre/misc.nim b/tests/stdlib/nre/misc.nim
index f4a88b639..dbb0ecdf9 100644
--- a/tests/stdlib/nre/misc.nim
+++ b/tests/stdlib/nre/misc.nim
@@ -1,11 +1,11 @@
 import unittest, nre, strutils, optional_nonstrict
 
-suite "Misc tests":
-  test "unicode":
+block: # Misc tests
+  block: # unicode
     check("".find(re"(*UTF8)").match == "")
     check("перевірка".replace(re"(*U)\w", "") == "")
 
-  test "empty or non-empty match":
+  block: # empty or non-empty match
     check("abc".findall(re"|.").join(":") == ":a::b::c:")
     check("abc".findall(re".|").join(":") == "a:b:c:")
 
diff --git a/tests/stdlib/nre/replace.nim b/tests/stdlib/nre/replace.nim
index 6f3436410..5cf659f21 100644
--- a/tests/stdlib/nre/replace.nim
+++ b/tests/stdlib/nre/replace.nim
@@ -1,13 +1,13 @@
 include nre
 import unittest
 
-suite "replace":
-  test "replace with 0-length strings":
+block: # replace
+  block: # replace with 0-length strings
     check("".replace(re"1", proc (v: RegexMatch): string = "1") == "")
     check(" ".replace(re"", proc (v: RegexMatch): string = "1") == "1 1")
     check("".replace(re"", proc (v: RegexMatch): string = "1") == "1")
 
-  test "regular replace":
+  block: # regular replace
     check("123".replace(re"\d", "foo") == "foofoofoo")
     check("123".replace(re"(\d)", "$1$1") == "112233")
     check("123".replace(re"(\d)(\d)", "$1$2") == "123")
@@ -15,7 +15,7 @@ suite "replace":
     check("123".replace(re"(?<foo>\d)(\d)", "$foo$#$#") == "1123")
     check("123".replace(re"(?<foo>\d)(\d)", "${foo}$#$#") == "1123")
 
-  test "replacing missing captures should throw instead of segfaulting":
+  block: # replacing missing captures should throw instead of segfaulting
     expect IndexDefect: discard "ab".replace(re"(a)|(b)", "$1$2")
     expect IndexDefect: discard "b".replace(re"(a)?(b)", "$1$2")
     expect KeyError: discard "b".replace(re"(a)?", "${foo}")
diff --git a/tests/stdlib/nre/split.nim b/tests/stdlib/nre/split.nim
index 9d57ea7d8..3cd57bb82 100644
--- a/tests/stdlib/nre/split.nim
+++ b/tests/stdlib/nre/split.nim
@@ -1,8 +1,8 @@
 import unittest, strutils
 include nre
 
-suite "string splitting":
-  test "splitting strings":
+block: # string splitting
+  block: # splitting strings
     check("1 2 3 4 5 6 ".split(re" ") == @["1", "2", "3", "4", "5", "6", ""])
     check("1  2  ".split(re(" ")) == @["1", "", "2", "", ""])
     check("1 2".split(re(" ")) == @["1", "2"])
@@ -10,22 +10,22 @@ suite "string splitting":
     check("".split(re"foo") == @[""])
     check("9".split(re"\son\s") == @["9"])
 
-  test "captured patterns":
+  block: # captured patterns
     check("12".split(re"(\d)") == @["", "1", "", "2", ""])
 
-  test "maxsplit":
+  block: # maxsplit
     check("123".split(re"", maxsplit = 2) == @["1", "23"])
     check("123".split(re"", maxsplit = 1) == @["123"])
     check("123".split(re"", maxsplit = -1) == @["1", "2", "3"])
 
-  test "split with 0-length match":
+  block: # split with 0-length match
     check("12345".split(re("")) == @["1", "2", "3", "4", "5"])
     check("".split(re"") == newSeq[string]())
     check("word word".split(re"\b") == @["word", " ", "word"])
     check("word\r\lword".split(re"(*ANYCRLF)(?m)$") == @["word", "\r\lword"])
     check("слово слово".split(re"(*U)(\b)") == @["", "слово", "", " ", "", "слово", ""])
 
-  test "perl split tests":
+  block: # perl split tests
     check("forty-two"                    .split(re"")      .join(",") == "f,o,r,t,y,-,t,w,o")
     check("forty-two"                    .split(re"", 3)   .join(",") == "f,o,rty-two")
     check("split this string"            .split(re" ")     .join(",") == "split,this,string")
@@ -47,7 +47,7 @@ suite "string splitting":
     check(""                             .split(re"")      .len       == 0)
     check(":"                            .split(re"")      .len       == 1)
 
-  test "start position":
+  block: # start position
     check("abc".split(re"", start = 1) == @["b", "c"])
     check("abc".split(re"", start = 2) == @["c"])
     check("abc".split(re"", start = 3) == newSeq[string]())