Rework nil/option for nre in light of ""==nil

Fixes #9243
This commit is contained in:
Flaviu Tamas 2018-11-18 21:41:40 -05:00
commit c0a47f7e22
No known key found for this signature in database
GPG key ID: D6BF32C876496756
6 changed files with 126 additions and 87 deletions

View file

@ -10,9 +10,9 @@ suite "match":
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")
check("abc".match(re"(\w)").captureBounds[0].get == 0 .. 0)
check("abc".match(re"").captureBounds[-1].get == 0 .. -1)
check("abc".match(re"abc").captureBounds[-1].get == 0 .. 2)
check("abc".match(re"(\w)").captureBounds[0] == 0 .. 0)
check("abc".match(re"").captureBounds[-1] == 0 .. -1)
check("abc".match(re"abc").captureBounds[-1] == 0 .. 2)
test "match test cases":
check("123".match(re"").matchBounds == 0 .. -1)