-
Notifications
You must be signed in to change notification settings - Fork 8
Closed
Labels
Description
I think I've stumbled across a bug. I'm using RegexpTrie 0.2.0.
Take this example from the tests:
RegexpTrie.union("foo", "foobar", "foobaz")
I would expect this to produce a Regexp like, say, /foo(?:ba[rz])?/
, but instead it produces /foo(?:)?/
.
This is significant because I often use Regexp.union
like this:
words = [ "foo", "foobar", "foobaz" ]
expr = /\b#{Regexp.union("foo", "foobar", "foobaz")}\b/ # => /\b(?-mix:foo|foobar|foobaz)\b/
assert(expr === "text foobar text")
But this doesn't work with RegexpTrie.union
:
words = [ "foo", "foobar", "foobaz" ]
expr = /\b#{RegexpTrie.union("foo", "foobar", "foobaz")}\b/ # => /\b(?-mix:foo(?:)?)\b/
assert(expr === "text foobar text")
# => Test::Unit::AssertionFailedError: <false> is not true.