Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 50 lines (33 sloc) 0.831 kb
c298bbd @felliott add test file for hash() method (includes test for RT #76826)
felliott authored
1 use v6;
2
3 use Test;
4
5 plan 8;
6
7 =begin pod
8
9 Basic tests for the hash() built-in
10
11 =end pod
12
13 # L<S29/Conversions/hash>
14
15 {
16 ok hash() ~~ Hash, 'hash() makes a hash';
17 }
18
19 {
20 "foo" ~~ /foo/;
21 is hash().elems, 0, "hash() doesn't auto-hash $/";
22 }
23
abc9cbd @coke pugs fudge
coke authored
24 #?pugs skip 'Unimplemented unaryOp: hash'
c298bbd @felliott add test file for hash() method (includes test for RT #76826)
felliott authored
25 {
26 is ('a'..'c' Z 1..3).hash.<a>, 1, "hash() builds a sensible hash";
27 is ('a'..'c' Z 1..3).hash.<b>, 2, "hash() builds a sensible hash";
28 is ('a'..'c' Z 1..3).hash.<c>, 3, "hash() builds a sensible hash";
29 }
30
abc9cbd @coke pugs fudge
coke authored
31 #?pugs todo 'Unimplemented unaryOp: hash'
c298bbd @felliott add test file for hash() method (includes test for RT #76826)
felliott authored
32 {
33 lives_ok {(a => 1, b => 2).hash.perl}, 'hash() on list of pairs lives (RT #76826)';
34 }
35
abc9cbd @coke pugs fudge
coke authored
36 #?pugs skip 'Unimplemented unaryOp: hash'
c298bbd @felliott add test file for hash() method (includes test for RT #76826)
felliott authored
37 {
38 dies_ok {hash(<1 2 3>)}, "hash() won't create invalid hash";
39 }
40
41
42 {
43 is ?hash(), Bool::False, "hash() is false";
44 }
45
46
47 done;
48
49 # vim: ft=perl6
Something went wrong with that request. Please try again.