Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 83 lines (70 sloc) 1.831 kb
ff2f9de @sorear Prototype of the Array class
authored
1 # vim: ft=perl6
2 use Test;
9f1bf0e @sorear Implement &sort
authored
3 use MONKEY_TYPING;
ff2f9de @sorear Prototype of the Array class
authored
4
2e2c977 @sorear Test + calling .Numeric (GH-3)
authored
5 {
6 # GH-3
7 my class A { method Numeric { 42 } }
8 is A.new + 23, 65, '+ calls user-written .Numeric';
9 }
a981b22 @sorear Merge back tryfile augments
authored
10
e7be5b2 @sorear Implement ability of regex matches to set $/
authored
11 {
12 "abc" ~~ /. (.) ./;
13 is $0, 'b', 'Regex matches set $/';
14 }
15
16 {
17 "abc" ~~ /de(.)/;
18 ok !defined($/), 'Failed regex matches clear $/';
19 }
20
f861d25 @sorear Tests for @foo[1,2] and @foo[*-1]
authored
21 {
22 my @foo = 1, 2, 3, 4, 5;
23
24 is @foo[2,3].join('|'), '3|4', 'slicing works';
25 is @foo[[1,4]].join('|'), 3, 'items do not slice';
3e87ab8 @sorear Add a few more slice tests
authored
26 ok !defined(@foo[4,5,6][1]), 'slices off end work';
27 @foo[1,2,3] = 5,6,7;
28 is @foo.join('|'), '1|5|6|7|5', 'can assign to slices';
29 @foo[4,5,6] = 1,2,3;
30 is @foo.join('|'), '1|5|6|7|1|2|3', 'can assign to slices off end';
31
32 my %quux;
33 %quux<a b c> = (1, 2, 3);
34 is %quux<b>, 2, 'can assign to hash slices';
35 is %quux<c b>.join('|'), '3|2', 'can read from hash slices';
36
37 my @bar = 1, 2, 3, 4, 5;
38 is @bar[{ $^x / 2 }], 3, 'code indexes work';
39 is @bar[*-1], 5, 'WhateverCode indexes work';
f861d25 @sorear Tests for @foo[1,2] and @foo[*-1]
authored
40 }
41
b46d150 @sorear Reimplement monkey typing using phasers
authored
42 {
43 my $str = '';
44 $str ~= 1;
45 INIT $str ~= 2;
46 $str ~= 3;
47 INIT $str ~= 4;
48 is $str, '2413', 'INIT blocks run in correct order';
49
589fce1 @sorear Miscellaneous fixes to get STD/tryfile.exe working again
authored
50 my @arr;
51 my $ix = -1;
52 ok !(defined @arr[$ix]), "can index before arrays to get undef";
53 }
54
0fa6f23 @sorear Fix Foo::Bar regression
authored
55 #is $?FILE, 'test.pl', '$?FILE works';
56 #is $?ORIG.substr(0,5), '# vim', '$?ORIG works';
57
58 # {
59 # {
60 # our $x = 5; #OK
61 # }
62 # ok $::x == 5, '$::x finds our variable';
63 #
64 # package Fao { our $y = 6; } #OK
65 # ok $::Fao::y == 6, '$::Fao::y works as $Fao::y';
66 #
67 # { class Mao { } }
68 # ok ::Mao.new.defined, 'can use classes via ::Mao';
69 # }
70 #
71 # {
72 # my $x = 7; #OK
73 # ok $::x == 7, '$::x can find lexicals';
74 # class A3 {
75 # method moo { 42 }
76 # class B4 {
77 # ok ::A3.moo, '::A3 can find outer classes';
78 # }
79 # }
80 # }
ae2e557 @sorear Implement control operators next, redo, last, return
authored
81
ff2f9de @sorear Prototype of the Array class
authored
82 done-testing;
Something went wrong with that request. Please try again.