From d4a82080696dea103e1fae8de2c056fab64e91e4 Mon Sep 17 00:00:00 2001 From: LoipesMas <46327403+LoipesMas@users.noreply.github.com> Date: Tue, 5 Dec 2023 00:04:13 +0100 Subject: [PATCH] Add more test cases --- crates/compiler/builtins/roc/Dict.roc | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/crates/compiler/builtins/roc/Dict.roc b/crates/compiler/builtins/roc/Dict.roc index a96ce62689..9323f696af 100644 --- a/crates/compiler/builtins/roc/Dict.roc +++ b/crates/compiler/builtins/roc/Dict.roc @@ -1515,3 +1515,37 @@ expect |> Dict.insert "Charlie" 19 d1 == d2 + +expect + keysToDelete = [1,2] + d1 = Dict.empty {} + |> Dict.insert 0 0 + |> Dict.insert 1 1 + |> Dict.insert 2 2 + |> Dict.insert 3 3 + |> Dict.insert 4 4 + |> Dict.keepIf (\(k,_v) -> List.contains keysToDelete k |> Bool.not) + + d2 = Dict.empty {} + |> Dict.insert 0 0 + |> Dict.insert 3 3 + |> Dict.insert 4 4 + + d1 == d2 + +expect + keysToDelete = [2,4] + d1 = Dict.empty {} + |> Dict.insert 0 0 + |> Dict.insert 1 1 + |> Dict.insert 2 2 + |> Dict.insert 3 3 + |> Dict.insert 4 4 + |> Dict.keepIf (\(k,_v) -> List.contains keysToDelete k |> Bool.not) + + d2 = Dict.empty {} + |> Dict.insert 0 0 + |> Dict.insert 1 1 + |> Dict.insert 3 3 + + d1 == d2