mirror of https://github.com/gobwas/glob.git
fix hanging on empty string
This commit is contained in:
parent
1a9b5d0057
commit
49571a1557
|
@ -64,6 +64,9 @@ func TestGlob(t *testing.T) {
|
|||
for _, test := range []test{
|
||||
glob(true, "* ?at * eyes", "my cat has very bright eyes"),
|
||||
|
||||
glob(true, "", ""),
|
||||
glob(false, "", "b"),
|
||||
|
||||
glob(true, "abc", "abc"),
|
||||
glob(true, "a*c", "abc"),
|
||||
glob(true, "a*c", "a12345c"),
|
||||
|
|
2
lexer.go
2
lexer.go
|
@ -152,7 +152,7 @@ func newLexer(source string) *lexer {
|
|||
l := &lexer{
|
||||
input: source,
|
||||
state: lexRaw,
|
||||
items: make(chan item, len(source)),
|
||||
items: make(chan item, len(source)+1),
|
||||
termPhrases: make(map[int]int),
|
||||
}
|
||||
return l
|
||||
|
|
|
@ -9,6 +9,12 @@ func TestLexGood(t *testing.T) {
|
|||
pattern string
|
||||
items []item
|
||||
}{
|
||||
{
|
||||
pattern: "",
|
||||
items: []item{
|
||||
item{item_eof, ""},
|
||||
},
|
||||
},
|
||||
{
|
||||
pattern: "hello",
|
||||
items: []item{
|
||||
|
|
Loading…
Reference in New Issue