Clean some code.

master
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 = let evaluate str =
match str with match str with
| str when is_url str -> | 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
match title with | Some t -> Some ("[ " ^ t ^ " ]")
| Some t -> Some ("[ " ^ t ^ " ]") | None -> None)
| None -> None
end
| "o/" -> Some "o/" | "o/" -> Some "o/"
| _ -> None | _ -> None

View File

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