Skip to content

Commit

Permalink
Better tests (and mark some as TODO)
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed May 18, 2016
1 parent cc90b0a commit 540c6c1
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions t/slices.t
Expand Up @@ -12,13 +12,13 @@ $hash{ key11 } = "eleven";

($one, $two) = @hash{ 'key1', 'key2' };

ok( $one eq $hash{ key1 } );
ok( $two eq $hash{ key2 } );
is( $one, $hash{ key1 }, 'Simple key check 1' );
is( $two, $hash{ key2 }, 'Simple key check 2' );

%ones = %hash{ 'key1', 'key11' };

ok( $ones{ key1 } eq $hash { key1 } );
ok( $ones{ key11 } eq $hash { key11 } );
is( $ones{ key1 }, $hash { key1 }, 'Simple key check 3' );
is( $ones{ key11 }, $hash { key11 }, 'Simple key check 4' );

undef $one;
undef $two;
Expand All @@ -28,17 +28,27 @@ undef %ones;

($one, $two) = @hash{ qr/^key\d$/ };

ok( $one eq $hash{ key1 } );
ok( $two eq $hash{ key2 } );
is( $one, $hash{ key1 }, 'Slice test 1' );

%ones = %hash{ qr/^key1+$/ };
TODO: {
local $TODO = q[This doesn't work];

ok( $ones{ key1 } eq $hash { key1 } );
ok( $ones{ key11 } eq $hash { key11 } );
is( $two, $hash{ key2 }, 'Slice test 2' );

@dels = delete @hash{ qr/^key\d$/ };
ok( $#dels == 1 );
%ones = %hash{ qr/^key1+$/ };

is( $ones{ key1 }, $hash { key1 }, 'Slice test 3' );
is( $ones{ key11 }, $hash { key11 }, 'Slice test 4' );

@dels = delete @hash{ qr/^key\d$/ };
is( $#dels, 1, 'Deletion test 1' );
}

@oops = delete @hash { 'key3', 'key2' };
ok( $#oops == 1 );
ok( $oops[0] eq undef );
is( $#oops, 1, 'Deletion test 2' );

TODO: {
local $TODO = q[This doesn't work];

ok( ! defined $oops[0], 'Deletion test 3' );
}

0 comments on commit 540c6c1

Please sign in to comment.