Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 72 lines (66 sloc) 3.095 kb
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
1 use v6;
2 use Test;
643bc98f » mberends
2010-08-22 replace plan *; with number of tests S03
3 plan 36;
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
4
5 #L<S03/Smart matching/arrays are comparable>
74e76019 » moritz
2010-03-21 [t/spec] a tiny unfudge for rakudo
6 {
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
7 ok((("blah", "blah") ~~ ("blah", "blah")), "qw/blah blah/ .eq");
8 ok(!((1, 2) ~~ (1, 1)), "1 2 !~~ 1 1");
9 ok(!((1, 2, 3) ~~ (1, 2)), "1 2 3 !~~ 1 2");
10 ok(!((1, 2) ~~ (1, 2, 3)), "1 2 !~~ 1 2 3");
ae8ff8de » jnthn
2010-03-13 [t/spec] Bring some tests in line with the spec.
11 ok(!([] ~~ [1]), "array smartmatch boundary conditions");
12 ok(!([1] ~~ []), "array smartmatch boundary conditions");
13 ok(([] ~~ []), "array smartmatch boundary conditions");
14 ok(([1] ~~ [1]), "array smartmatch boundary conditions");
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
15 #?niecza todo
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
16 ok((1,2,3,4) ~~ (1,*), 'array smartmatch dwims * at end');
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
17 #?niecza todo
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
18 ok((1,2,3,4) ~~ (1,*,*), 'array smartmatch dwims * at end (many *s)');
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
19 #?niecza todo
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
20 ok((1,2,3,4) ~~ (*,4), 'array smartmatch dwims * at start');
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
21 #?niecza todo
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
22 ok((1,2,3,4) ~~ (*,*,4), 'array smartmatch dwims * at start (many *s)');
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
23 #?niecza todo
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
24 ok((1,2,3,4) ~~ (1,*,3,4), 'array smartmatch dwims * 1 elem');
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
25 #?niecza todo
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
26 ok((1,2,3,4) ~~ (1,*,*,3,4), 'array smartmatch dwims * 1 elem (many *s)');
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
27 #?niecza todo
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
28 ok((1,2,3,4) ~~ (1,*,4), 'array smartmatch dwims * many elems');
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
29 #?niecza todo
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
30 ok((1,2,3,4) ~~ (1,*,*,4), 'array smartmatch dwims * many elems (many *s)');
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
31 #?niecza todo
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
32 ok((1,2,3,4) ~~ (*,3,*), 'array smartmatch dwims * at start and end');
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
33 #?niecza todo
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
34 ok((1,2,3,4) ~~ (*,*,3,*,*), 'array smartmatch dwims * at start and end (many *s)');
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
35 #?niecza todo
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
36 ok((1,2,3,4) ~~ (*,1,2,3,4), 'array smartmatch dwims * can match nothing at start');
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
37 #?niecza todo
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
38 ok((1,2,3,4) ~~ (*,*,1,2,3,4), 'array smartmatch dwims * can match nothing at start (many *s)');
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
39 #?niecza todo
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
40 ok((1,2,3,4) ~~ (1,2,*,3,4), 'array smartmatch dwims * can match nothing in middle');
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
41 #?niecza todo
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
42 ok((1,2,3,4) ~~ (1,2,*,*,3,4), 'array smartmatch dwims * can match nothing in middle (many *s)');
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
43 #?niecza todo
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
44 ok((1,2,3,4) ~~ (1,2,3,4,*), 'array smartmatch dwims * can match nothing at end');
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
45 #?niecza todo
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
46 ok((1,2,3,4) ~~ (1,2,3,4,*,*), 'array smartmatch dwims * can match nothing at end (many *s)');
47 ok(!((1,2,3,4) ~~ (1,*,3)), '* dwimming does not cause craziness');
48 ok(!((1,2,3,4) ~~ (*,5)), '* dwimming does not cause craziness');
49 ok(!((1,2,3,4) ~~ (1,3,*)), '* dwimming does not cause craziness');
50
51 # now try it with arrays as well
52 my @a = 1, 2, 3;
53 my @b = 1, 2, 4;
54 my @m = (*, 2, *); # m as "magic" ;-)
55
56 ok (@a ~~ @a), 'Basic smartmatching on arrays (positive)';
57 ok (@a !~~ @b), 'Basic smartmatching on arrays (negative)';
58 ok (@b !~~ @a), 'Basic smartmatching on arrays (negative)';
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
59 #?niecza todo
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
60 ok (@a ~~ @m), 'Whatever dwimminess in arrays';
61 ok (@a ~~ (1, 2, 3)), 'smartmatch Array ~~ List';
62 ok ((1, 2, 3) ~~ @a), 'smartmatch List ~~ Array';
4bdf17ed » coke
2011-09-29 Convert niecza faux-todo to real todo.
63 #?niecza todo
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
64 ok ((1, 2, 3) ~~ @m), 'smartmatch List ~~ Array with dwim';
65
66 ok (1 ~~ *,1,*), 'smartmatch with Array RHS co-erces LHS to list';
67 ok (1..10 ~~ *,5,*), 'smartmatch with Array RHS co-erces LHS to list';
68 }
69
e76dd4c7 » moritz
2010-12-31 s/done_testing/done/ as per recent S24 changes
70 done;
e67eb0c6 » kyle
2010-01-15 [t/spec] split S03-operators/smartmatch.t into S03-smartmatch/*.t
71
72 # vim: ft=perl6
Something went wrong with that request. Please try again.