Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 50 lines (36 sloc) 1.27 kb
58135b3 [t/spec] changed 'use v6-alpha;' to 'use v6;'
moritz authored
1 use v6;
8bed649 Added svn props to test scripts
cosimo authored
2
3 use Test;
4
c5fa27b @moritz [S32] remove more tests for now-gone calling-positionals-by-named tests
moritz authored
5 plan 14;
8bed649 Added svn props to test scripts
cosimo authored
6
f46415e [t/spec] unconfuse Pod
moritz authored
7 =begin pod
8bed649 Added svn props to test scripts
cosimo authored
8
5f35d0f [t/spec] fix smartlinks in S32-hash
moritz authored
9 #Basic C<keys> and C<values> tests for hashes and pairs, see S32::Containers.
8bed649 Added svn props to test scripts
cosimo authored
10
f46415e [t/spec] unconfuse Pod
moritz authored
11 =end pod
8bed649 Added svn props to test scripts
cosimo authored
12
13 my %hash = (a => 1, b => 2, c => 3, d => 4);
14
5f35d0f [t/spec] fix smartlinks in S32-hash
moritz authored
15 # L<S32::Containers/"Hash"/=item keys>
8bed649 Added svn props to test scripts
cosimo authored
16 is(~%hash.keys.sort, "a b c d", '%hash.keys works');
17 is(~sort(keys(%hash)), "a b c d", 'keys(%hash) on hashes');
18 is(+%hash.keys, +%hash, 'we have the same number of keys as elements in the hash');
19
5f35d0f [t/spec] fix smartlinks in S32-hash
moritz authored
20 # L<S32::Containers/"Hash"/=item values>
77ec25f @coke pugs fudge
coke authored
21 #?pugs todo
8bed649 Added svn props to test scripts
cosimo authored
22 is(~%hash.values.sort, "1 2 3 4", '%hash.values works');
77ec25f @coke pugs fudge
coke authored
23 #?pugs todo
8bed649 Added svn props to test scripts
cosimo authored
24 is(~sort(values(%hash)), "1 2 3 4", 'values(%hash) works');
25 is(+%hash.values, +%hash, 'we have the same number of keys as elements in the hash');
26
27 # keys and values on Pairs
28 my $pair = (a => 42);
3a7da94 @coke niecza fudging
coke authored
29 #?niecza todo
73fa45b @moritz fudge tests, and make others more robust
moritz authored
30 is(~$pair.keys, "a", '$pair.keys works');
3a7da94 @coke niecza fudging
coke authored
31 #?niecza todo
73fa45b @moritz fudge tests, and make others more robust
moritz authored
32 is(~keys($pair), "a", 'keys($pair) works');
33 is($pair.keys.elems, 1, 'we have one key');
8bed649 Added svn props to test scripts
cosimo authored
34
3a7da94 @coke niecza fudging
coke authored
35 #?niecza todo
73fa45b @moritz fudge tests, and make others more robust
moritz authored
36 is(~$pair.values, 42, '$pair.values works');
3a7da94 @coke niecza fudging
coke authored
37 #?niecza todo
73fa45b @moritz fudge tests, and make others more robust
moritz authored
38 is(~values($pair), 42, 'values($pair) works');
39 is($pair.values.elems, 1, 'we have one value');
cd614c7 [t/spec] test that my $x; $x.values; lives
moritz authored
40
41 # test that .keys and .values work on Any values as well;
42
43 {
44 my $x;
45 lives_ok { $x.values }, 'Can call Any.values';
46 lives_ok { $x.keys }, 'Can call Any.keys';
47
48 }
dfb413c [t] added named arg test to end
frew authored
49 #vim: ft=perl6
Something went wrong with that request. Please try again.