aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2017-04-25 22:15:52 +0200
committerPatrick Spek <p.spek@tyil.nl>2017-04-25 22:15:52 +0200
commit7270ba5fe15aa830b32831d7b66045fac6855adc (patch)
tree3406459364aa5a6293ae53dd40742ec645d7655d
parent9d36fa6bbdc73c8049b4f4a657458c3b7d37e941 (diff)
Add tests for merging into empty hash
-rw-r--r--t/02-empty-source.t28
1 files changed, 28 insertions, 0 deletions
diff --git a/t/02-empty-source.t b/t/02-empty-source.t
new file mode 100644
index 0000000..684a98b
--- /dev/null
+++ b/t/02-empty-source.t
@@ -0,0 +1,28 @@
+#! /usr/bin/env perl6
+
+use v6.c;
+use lib 'lib';
+use Test;
+
+plan 2;
+
+use Hash::Merge;
+
+my Hash $hash = {
+ a => "a",
+ b => {
+ c => "c"
+ }
+};
+
+my Hash $empty = {};
+
+$empty.merge($hash);
+
+is-deeply $empty, $hash, "Merge into empty hash";
+
+my Hash $nil;
+
+$nil.merge($hash);
+
+is-deeply $nil, $hash, "Merge into uninitialized hash";