Skip to content

Commit

Permalink
Tests: do not use Option.get (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmbaturin authored Oct 16, 2021
1 parent e185160 commit de265fa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ let map_option f = function
| None -> None
| Some v -> Some (f v)

let unwrap_option = function
| None -> failwith "trying to unwrap a None"
| Some v -> v

let page : string -> string =
let table = Hashtbl.create 7 in

Expand Down Expand Up @@ -342,7 +346,7 @@ let suites = [

("matches-selector" >:: fun _ ->
let soup = parse "<div> <p id='foo'>bar</p> </div>" in
let elem = select_one "div p#foo" soup |> Option.get in
let elem = select_one "div p#foo" soup |> unwrap_option in
assert_bool "element matches selector" (matches_selector soup "div p#foo" elem)
);

Expand Down

0 comments on commit de265fa

Please sign in to comment.