remove old implementation of the roof operator; make tests green again; close #6292

This commit is contained in:
Andreas Rumpf 2017-10-29 20:36:07 +01:00
commit f1dab39086
13 changed files with 28 additions and 161 deletions

View file

@ -32,7 +32,7 @@ suite "captures":
test "named capture bounds":
let ex1 = "foo".find(re("(?<foo>foo)(?<bar>bar)?"))
check(ex1.captureBounds["foo"] == some(0..2))
check(ex1.captureBounds["bar"] == none(Slice[int]))
check(ex1.captureBounds["bar"] == none(Slice[int, int]))
test "capture count":
let ex1 = re("(?<foo>foo)(?<bar>bar)?")
@ -42,7 +42,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.captureBounds.toTable == {"foo" : some(0..2), "bar" : none(Slice[int])}.toTable())
check(ex1.captureBounds.toTable == {"foo" : some(0..2), "bar" : none(Slice[int, int])}.toTable())
check(ex1.captures.toTable("") == {"foo" : "foo", "bar" : ""}.toTable())
let ex2 = "foobar".find(re("(?<foo>foo)(?<bar>bar)?"))
@ -51,7 +51,7 @@ suite "captures":
test "capture sequence":
let ex1 = "foo".find(re("(?<foo>foo)(?<bar>bar)?"))
check(ex1.captures.toSeq == @["foo", nil])
check(ex1.captureBounds.toSeq == @[some(0..2), none(Slice[int])])
check(ex1.captureBounds.toSeq == @[some(0..2), none(Slice[int, int])])
check(ex1.captures.toSeq("") == @["foo", ""])
let ex2 = "foobar".find(re("(?<foo>foo)(?<bar>bar)?"))

View file

@ -12,7 +12,7 @@ suite "find":
test "find bounds":
check(toSeq(findIter("1 2 3 4 5 ", re" ")).map(
proc (a: RegexMatch): Slice[int] = a.matchBounds
proc (a: RegexMatch): Slice[int, int] = a.matchBounds
) == @[1..1, 3..3, 5..5, 7..7, 9..9])
test "overlapping find":