cheesebot/ocaml/test.ml
Fabien Freling 062fd87bf5 Removes spaces in URL titles.
This is mainly used for Imgur.
2014-12-12 23:20:51 +01:00

37 lines
750 B
OCaml

open OUnit2
let test_get_title test_ctxt =
let body = "<!DOCTYPE html>
<html lang=\"en\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />
<title>Fabien</title>
</head>
<body>
<h1>Header</h1>
</body>
</html>" in
let title = SimpleHttp.get_http_title body in
assert_equal (Some "Fabien") title
let test_remove_spaces test_ctxt =
let str = "
foo bar baz
" in
let cleaned_str = Evaluate.remove_spaces str in
assert_equal "foo bar baz" cleaned_str
(* Name the test cases and group them together *)
let suite =
"suite">:::
["test get_title">:: test_get_title;
"test remove_spaces">:: test_remove_spaces]
let () =
run_test_tt_main suite