diff --git a/src/test/contracts/map.ligo b/src/test/contracts/map.ligo index 71be5dc20..24a267884 100644 --- a/src/test/contracts/map.ligo +++ b/src/test/contracts/map.ligo @@ -29,6 +29,10 @@ function patch_ (var m: foobar) : foobar is block { patch m with map [0 -> 5; 1 -> 6; 2 -> 7] } with m +function patch_empty (var m : foobar) : foobar is block { + patch m with map [] +} with m + function size_ (const m : foobar) : nat is block {skip} with (size(m)) diff --git a/src/test/contracts/map.mligo b/src/test/contracts/map.mligo index 88089d985..18a84d104 100644 --- a/src/test/contracts/map.mligo +++ b/src/test/contracts/map.mligo @@ -14,6 +14,9 @@ let rm (m : foobar) : foobar = Map.remove 42 m (* Dummy test so that we can add the same test for PascaLIGO *) let patch_ (m : foobar) : foobar = Map.literal [ (0, 5) ; (1, 6) ; (2, 7) ] +(* Second dummy test, see above *) +let patch_empty (m : foobar) : foobar = Map.literal [ (0, 0) ; (1, 1) ; (2, 2) ] + let size_ (m : foobar) : nat = Map.size m let gf (m : foobar) : int = Map.find 23 m diff --git a/src/test/integration_tests.ml b/src/test/integration_tests.ml index 7e9f5c3b1..ad1ce6d69 100644 --- a/src/test/integration_tests.ml +++ b/src/test/integration_tests.ml @@ -416,6 +416,11 @@ let map_ type_f path : unit result = let expected = ez [(0, 5) ; (1, 6) ; (2, 7)] in expect_eq program "patch_" input expected in + let%bind () = + let input = ez [(0,0) ; (1,1) ; (2,2)] in + let expected = ez [(0,0) ; (1,1) ; (2,2)] in + expect_eq program "patch_empty" input expected + in let%bind () = let make_input = fun n -> ez List.(map (fun x -> (x, x)) @@ range n) in let make_expected = e_nat in