Add unit test for HTML title.
This commit is contained in:
parent
1ab32d004c
commit
5b790d3f09
|
@ -1 +1,2 @@
|
|||
true: package(ssl,netclient,netstring,equeue-ssl)
|
||||
<test.*>: package(oUnit)
|
||||
|
|
25
ocaml/test.ml
Normal file
25
ocaml/test.ml
Normal file
|
@ -0,0 +1,25 @@
|
|||
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
|
||||
|
||||
|
||||
(* Name the test cases and group them together *)
|
||||
let suite =
|
||||
"suite">:::
|
||||
["test get_title">:: test_get_title]
|
||||
|
||||
let () =
|
||||
run_test_tt_main suite
|
Loading…
Reference in a new issue