Clean some code.

This commit is contained in:
Fabien Freling 2014-12-21 17:00:07 +01:00
parent ac5cafeb21
commit 0046f46bbd
2 changed files with 6 additions and 8 deletions

View file

@ -25,11 +25,9 @@ let remove_spaces str =
let evaluate str =
match str with
| str when is_url str ->
begin
let title = SimpleHttp.get_http_title (SimpleHttp.get_body str) |> remove_spaces in
(let title = SimpleHttp.get_http_title (SimpleHttp.get_body str) |> remove_spaces in
match title with
| Some t -> Some ("[ " ^ t ^ " ]")
| None -> None
end
| None -> None)
| "o/" -> Some "o/"
| _ -> None

View file

@ -22,8 +22,8 @@ let test_remove_spaces test_ctxt =
foo bar baz
" in
let cleaned_str = Evaluate.remove_spaces str in
assert_equal "foo bar baz" cleaned_str
let cleaned_str = Evaluate.remove_spaces (Some str) in
assert_equal (Some "foo bar baz") cleaned_str
(* Name the test cases and group them together *)