File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments