Skip to content
Permalink
Browse files

Merge pull request #673 from samoht/tree-remove

Fix Tree.remove
  • Loading branch information...
samoht committed Apr 15, 2019
2 parents 2a53fa8 + 541b555 commit 96300b6b539ba77b680a3de72536c3e071dd8e28
Showing with 7 additions and 1 deletion.
  1. +6 −0 src/irmin-test/store.ml
  2. +1 −1 src/irmin/tree.ml
@@ -1111,6 +1111,12 @@ module Make (S : S) = struct
let foo2 = random_value 10 in
(* Testing [Tree.remove] *)
S.Tree.empty |> fun v1 ->
S.Tree.add v1 [ "foo"; "toto" ] foo1 >>= fun v1 ->
S.Tree.add v1 [ "foo"; "bar"; "toto" ] foo2 >>= fun v1 ->
S.Tree.remove v1 [ "foo"; "bar"; "toto" ] >>= fun v1 ->
S.Tree.find v1 [ "foo"; "toto" ] >>= fun v ->
Alcotest.(check (option string)) "remove" (Some foo1) v;
S.Tree.empty |> fun v1 ->
S.Tree.stats v1 >>= fun s ->
Alcotest.(check stats_t) "empty stats" empty_stats s;
S.Tree.add v1 [ "foo"; "1" ] foo1 >>= fun v1 ->
@@ -688,7 +688,7 @@ module Make (P : S.PRIVATE) = struct
(* remove empty dirs *)
Node.is_empty child'
>>= function
| true -> may_remove view h
| true -> may_remove view h >>= k
| false -> Node.add view h (`Node child') >>= some ) )
)
in

0 comments on commit 96300b6

Please sign in to comment.
You can’t perform that action at this time.