mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
bugfix and test for CCZipper.is_focused (closes #102)
This commit is contained in:
parent
97abfe600e
commit
b5be1d71a9
1 changed files with 12 additions and 3 deletions
|
|
@ -15,8 +15,12 @@ let to_list (l,r) = List.rev_append l r
|
|||
|
||||
let to_rev_list (l,r) = List.rev_append r l
|
||||
|
||||
(*$inject
|
||||
let zip_gen = Q.(pair (small_list int)(small_list int))
|
||||
*)
|
||||
|
||||
(*$Q
|
||||
Q.(pair (list small_int)(list small_int)) (fun z -> \
|
||||
zip_gen (fun z -> \
|
||||
to_list z = List.rev (to_rev_list z))
|
||||
*)
|
||||
|
||||
|
|
@ -51,13 +55,18 @@ let modify f z = match z with
|
|||
end
|
||||
|
||||
let is_focused = function
|
||||
| _, [] -> true
|
||||
| _ -> false
|
||||
| _, _::_ -> true
|
||||
| _, [] -> false
|
||||
|
||||
let focused = function
|
||||
| _, x::_ -> Some x
|
||||
| _, [] -> None
|
||||
|
||||
(*$Q
|
||||
zip_gen (fun g -> \
|
||||
is_focused g = (focused g |> CCOpt.is_some))
|
||||
*)
|
||||
|
||||
let focused_exn = function
|
||||
| _, x::_ -> x
|
||||
| _, [] -> raise Not_found
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue