aboutsummaryrefslogtreecommitdiff
path: root/t/02-empty-source.t
blob: 2737d2d4d92a5d6e708dd1ba2768913e20b5b27d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#! /usr/bin/env perl6

use v6.c;
use lib 'lib';
use Test;

plan 3;

use Hash::Merge::Augment;

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;


throws-like $nil.merge($hash), Exception, "Merge into uninitialized hash";
is-deeply $nil.merge($hash), $hash, "Returns supplied hash if it throws";