From b14362cc32b774e7894c9a597d57d876a564ecae Mon Sep 17 00:00:00 2001 From: Felix Ostmann Date: Mon, 11 Mar 2019 13:40:51 +0100 Subject: [PATCH 1/2] empty hashrefs should be ignored --- t/merge.t | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/t/merge.t b/t/merge.t index 36b0d16..64f562a 100644 --- a/t/merge.t +++ b/t/merge.t @@ -51,6 +51,28 @@ sub merge_ok { }; } +# empty hashes should be ignored +{ + my $hash1 = { + foo => 1, + bar => 2, + }; + + my $hash2 = { + bar => 3, + baz => 4, + }; + + my $hash3 = { + }; + + merge_ok [ $hash1, $hash2, $hash3 ], { + foo => 1, + bar => 3, + baz => 5, + }; +} + # where there are conflicts, confirm the rightmost array takes precedence # (also confirms more than 2 hashes can be merged) { From 375cd820cbcbf288fadac736f6524e99939c10c8 Mon Sep 17 00:00:00 2001 From: Felix Ostmann Date: Mon, 11 Mar 2019 13:45:49 +0100 Subject: [PATCH 2/2] Bugfix --- t/merge.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/merge.t b/t/merge.t index 64f562a..f8ff5c6 100644 --- a/t/merge.t +++ b/t/merge.t @@ -69,7 +69,7 @@ sub merge_ok { merge_ok [ $hash1, $hash2, $hash3 ], { foo => 1, bar => 3, - baz => 5, + baz => 4, }; }