Add unit test for url parser.
This commit is contained in:
parent
383920e6ee
commit
fcf9fa63b2
|
@ -38,6 +38,21 @@ let test_https test_ctx =
|
|||
let title = SimpleHttp.get_http_title (SimpleHttp.get_body url) in
|
||||
assert_equal (Some "Wikipedia, the free encyclopedia") title
|
||||
|
||||
|
||||
let test_is_url test_ctx =
|
||||
let urls = [
|
||||
("http://foo.bar", true);
|
||||
("https://foo.bar", true);
|
||||
("www.foo.bar", true);
|
||||
("foo.bar", true);
|
||||
("http://www.foo.bar", true);
|
||||
("foo-bar", false);
|
||||
("http://www.foo.bar/baz/quuz", true)
|
||||
] in
|
||||
let check (url, b) = assert_equal (Evaluate.is_url url) b in
|
||||
List.iter check urls
|
||||
|
||||
|
||||
(* Name the test cases and group them together *)
|
||||
let suite =
|
||||
"suite">:::
|
||||
|
|
Loading…
Reference in a new issue