@@ -4,21 +4,29 @@ use v6;
4
4
5
5
use Test ;
6
6
7
- plan 7 ;
7
+ plan 8 ;
8
8
9
- is do {flip " hello" }, " olleh" ;
10
- is do {join " , " , reverse <ab cd ef >}, " ef, cd, ab" ;
9
+ is do {flip " hello" }, " olleh" , ' string reversal ' ;
10
+ is do {join " , " , reverse <ab cd ef >}, " ef, cd, ab" , ' list reversal ' ;
11
11
12
12
my % capitals = France => " Paris" , UK => " London" ;
13
- is_deeply % capitals . invert , (" Paris" => " France" , " London" => " UK" ). list. item;
13
+ is_deeply % capitals . invert , (" Paris" => " France" , " London" => " UK" ). list. item, ' hash inversion ' ;
14
14
15
15
my % original := % capitals ;
16
16
my % inverse ;
17
17
% inverse . push ( % original . invert );
18
18
19
- is_deeply % inverse , {" Paris" => " France" , " London" => " UK" };
19
+ is_deeply % inverse , {" Paris" => " France" , " London" => " UK" }, ' hash inversion, non-distructive ' ;
20
20
21
21
my % h ;
22
- % h . push (' foo' => 1 ); is_deeply % h , {foo => 1 };
23
- % h . push (' foo' => 2 ); is_deeply % h , {foo => [1 , 2 ]};
24
- % h . push (' foo' => 3 ); is_deeply % h , {foo => [1 , 2 , 3 ]};
22
+
23
+ % h . push (' foo' => 1 );
24
+ is_deeply % h , {foo => 1 }, ' hash element push' ;
25
+
26
+ % h . push (' foo' => 2 );
27
+ is_deeply % h , {foo => [1 , 2 ]}, ' hash element push' ;
28
+
29
+ % h . push (' foo' => 3 );
30
+ is_deeply % h , {foo => [1 , 2 , 3 ]}, ' hash element push' ;
31
+
32
+ is_deeply flip (<a b c >. list), " c b a" , ' flip coercement (list)' ;
0 commit comments