Skip to content

Commit a8f2cf0

Browse files
Add fuzz tests
1 parent 6b76be8 commit a8f2cf0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

spec/std/file/match_spec.cr

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,13 @@ describe File do
245245
assert_file_matches "ab{{c,d}ef,}", "abdef"
246246
end
247247
end
248+
249+
it "fuzz tests" do
250+
# https://github.com/devongovett/glob-match/issues/1
251+
s = "{*{??*{??**,Uz*zz}w**{*{**a,z***b*[!}w??*azzzzzzzz*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!z[za,z&zz}w**z*z*}"
252+
refute_file_matches s, s
253+
s = "**** *{*{??*{??***\u{5} *{*{??*{??***\u{5},\0U\0}]*****\u{1},\0***\0,\0\0}w****,\0U\0}]*****\u{1},\0***\0,\0\0}w*****\u{1}***{}*.*\0\0*\0"
254+
# Must use `String` overload here because `Path` raises on null byte
255+
File.match?(s, s).should be_false
256+
end
248257
end

0 commit comments

Comments
 (0)