Skip to content
Browse files

Added tests for BatSubstring.is_prefix

  • Loading branch information...
1 parent 326bae5 commit 7cb546bf859524b392d346f90237f3383866ff34 @rgrinberg committed Oct 7, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 testsuite/test_substring.ml
View
12 testsuite/test_substring.ml
@@ -161,6 +161,17 @@ let test_rindex_from =
end;
];;
+let test_is_prefix =
+ let aeq = assert_equal ~printer:string_of_bool in
+ [
+ begin "is_prefix" >:: fun () ->
+ aeq (is_prefix "foo" (of_string "foobar")) true;
+ aeq (is_prefix "foj" (of_string "foobar")) false;
+ aeq (is_prefix "foobarz" (of_string "foobar")) false;
+ aeq (is_prefix "foobar" (of_string "foobar")) true;
+ end;
+ ];;
+
let tests = "Substring" >::: [
"dropr" >::: test_dropr;
"dropl" >::: test_dropl;
@@ -170,4 +181,5 @@ let tests = "Substring" >::: [
"splitl" >::: test_splitl;
"slice" >::: test_slice;
"index_from" >::: test_index_from;
+ "is_prefix" >::: test_is_prefix;
];;

0 comments on commit 7cb546b

Please sign in to comment.
Something went wrong with that request. Please try again.