Skip to content

Commit 12ea3fb

Browse files
committed
Add test for NULs in search data
1 parent 7e3799a commit 12ea3fb

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

fuzzy_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,17 @@ func TestFindWithCannedData(t *testing.T) {
107107
},
108108
},
109109
},
110+
// NULs are ignored and don't cause a panic
111+
{
112+
"ab", []string{"alphabet\x00\x00\x00\x00bet"}, []fuzzy.Match{
113+
{
114+
Str: "alphabet\x00\x00\x00\x00bet",
115+
Index: 0,
116+
MatchedIndexes: []int{0, 5},
117+
Score: 4,
118+
},
119+
},
120+
},
110121
}
111122
for _, c := range cases {
112123
matches := fuzzy.Find(c.pattern, c.data)

0 commit comments

Comments
 (0)