Browse files

z_string: Add tests for trim_left, trim_right

  • Loading branch information...
1 parent 90435eb commit f3a8cb8679adb570c6bc7fc311bd64dba78ca711 @arjan arjan committed Oct 16, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 test/z_string_test.erl
View
15 test/z_string_test.erl
@@ -40,3 +40,18 @@ ends_with_test() ->
?assertNot(z_string:ends_with(["is ", <<"jpeg.">>], "This is text.")),
ok.
+trim_left_test() ->
+ ?assertEqual("foo", z_string:trim_left(" foo")),
+ ?assertEqual("foo", z_string:trim_left(" foo")),
+ ?assertEqual("foo", z_string:trim_left(".foo", $.)),
+ ?assertEqual("foo", z_string:trim_left("......foo", $.)),
+ ok.
+
+
+trim_right_test() ->
+ ?assertEqual("foo", z_string:trim_right("foo ")),
+ ?assertEqual("foo", z_string:trim_right("foo ")),
+ ?assertEqual("foo", z_string:trim_right("foo.", $.)),
+ ?assertEqual("foo", z_string:trim_right("foo........", $.)),
+ ok.
+

0 comments on commit f3a8cb8

Please sign in to comment.