Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 47 lines (30 sloc) 0.705 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
24 {
25 is ('a'..'c' Z 1..3).hash.<a>, 1, "hash() builds a sensible hash";
26 is ('a'..'c' Z 1..3).hash.<b>, 2, "hash() builds a sensible hash";
27 is ('a'..'c' Z 1..3).hash.<c>, 3, "hash() builds a sensible hash";
28 }
29
30 {
31 lives_ok {(a => 1, b => 2).hash.perl}, 'hash() on list of pairs lives (RT #76826)';
32 }
33
34 {
35 dies_ok {hash(<1 2 3>)}, "hash() won't create invalid hash";
36 }
37
38
39 {
40 is ?hash(), Bool::False, "hash() is false";
41 }
42
43
44 done;
45
46 # vim: ft=perl6
Something went wrong with that request. Please try again.