diff --git a/src/glob.ml b/src/glob.ml index 5ccdc08..19ce3df 100644 --- a/src/glob.ml +++ b/src/glob.ml @@ -57,7 +57,7 @@ let compile_char_class = function let i = Char.code c in let c1_code = Char.code c1 in let c2_code = Char.code c2 in - if c1_code < c2_code then i >= c1_code && i <= c2_code else false + if c1_code <= c2_code then i >= c1_code && i <= c2_code else false let compile_char_classes css = let rec loop cs v = diff --git a/test/test.ml b/test/test.ml index 08a22bf..791e7e3 100644 --- a/test/test.ml +++ b/test/test.ml @@ -74,7 +74,11 @@ let test_matches () = matches ~msg:"char-range" Glob.[ range 'a' 'z'; ranges [ Chars [ 'd'; 'e' ] ]; string "llo.txt" ] [ "hello.txt"; "world.txt" ] - [ "hello.txt" ] + [ "hello.txt" ]; + matches ~msg:"char-range-singleton" + Glob.[ range 'a' 'a'; string "bc" ] + [ "abc"; "bbc" ] + [ "abc" ] let test_split () = let split ?(msg = "same split") t (p, v) =