diff --git a/ocaml/test.ml b/ocaml/test.ml index 8bd6caa..5226619 100644 --- a/ocaml/test.ml +++ b/ocaml/test.ml @@ -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">:::