Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 50 lines (33 sloc) 0.831 kb
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
use v6;

use Test;

plan 8;

=begin pod

Basic tests for the hash() built-in

=end pod

# L<S29/Conversions/hash>

{
    ok hash() ~~ Hash, 'hash() makes a hash';
}

{
    "foo" ~~ /foo/;
    is hash().elems, 0, "hash() doesn't auto-hash $/";
}

#?pugs skip 'Unimplemented unaryOp: hash'
{
    is ('a'..'c' Z 1..3).hash.<a>, 1, "hash() builds a sensible hash";
    is ('a'..'c' Z 1..3).hash.<b>, 2, "hash() builds a sensible hash";
    is ('a'..'c' Z 1..3).hash.<c>, 3, "hash() builds a sensible hash";
}

#?pugs todo 'Unimplemented unaryOp: hash'
{
    lives_ok {(a => 1, b => 2).hash.perl}, 'hash() on list of pairs lives (RT #76826)';
}

#?pugs skip 'Unimplemented unaryOp: hash'
{
    dies_ok {hash(<1 2 3>)}, "hash() won't create invalid hash";
}


{
    is ?hash(), Bool::False, "hash() is false";
}


done;

# vim: ft=perl6
Something went wrong with that request. Please try again.