#!perl -T
use 5.006;
use strict;
use warnings;
use Data::Dumper;
use Test::More tests => 7;

use Deep::Hash::Exists qw( is_exists );

my $hash_ref = {
        A => 'one',
        B => [ 'one', 'two' ],
        C => { 
            'one' => 1, 
            'two' => 2, 
        },
};

ok( is_exists( $hash_ref, [ 'A' ] ), q(Key 'A' is exists) );
ok( is_exists( $hash_ref, [ 'B' ] ), q(Key 'B' is exists) );
ok( ! is_exists( $hash_ref, [ 'B', '0' ] ), q(Key 'B'->'0' isn't exists) );
ok( is_exists( $hash_ref, [ 'C', 'one' ] ), q(Key 'C'->'one' is exists) );
ok( ! is_exists( $hash_ref, [ 'C', 'three' ] ), q(Key 'C'->'three' isn't exists) );
ok( ! is_exists( $hash_ref, [ 'C', 'three', 'PI', '0' ] ), q(Key 'C'->'three'->'PI'->'0' isn't exists) );
unlike( Dumper( $hash_ref ), qr(PI), q(Subroutine does not create new keys) );


