root/t/unspecced/evaluation_order.t

Revision 20490, 2.2 kB (checked in by Auzon, 8 months ago)

s/use v6-alpha;$/use v6;/;
Also catching a few other mentions of v6-alpha.

  • Property svn:mime-type set to text/plain; charset=UTF-8
  • Property svn:eol-style set to native
Line 
1use v6;
2
3use Test;
4
5plan 17;
6
7throws_ok {
8        die "first";
9        die "second";
10}, "first", "this better work ;-)";
11
12throws_ok {
13        (die "first")[die "second"];
14}, "first", "evaluation order of array access";
15
16throws_ok {
17        (die "first"){die "second"};
18}, "first", "evaluation order of hash access";
19
20throws_ok {
21        my @a;
22        @a[die "first"] = die "second";
23}, "first", "evaluation order of left/right sides of array assignment";
24
25throws_ok {
26        my @a;
27        @a[die "first"] := die "second";
28}, "first", "evaluation order of left/right sides of array binding", :todo<bug>;
29
30throws_ok {
31        my sub foo ($arg) is rw { my $var };
32        foo(die "first") = die "second";
33}, "first", "evaluation order of left/right sides of lvalue sub assignment (1)";
34
35throws_ok {
36        my sub foo ($arg) is rw { my $var };
37        foo(die "first") := die "second";
38}, "first", "evaluation order of left/right sides of lvalue sub binding (1)", :todo<bug>;
39
40throws_ok {
41        my sub foo ($arg) is rw { die "second"; my $var };
42        foo(die "first") = die "third";
43}, "first", "evaluation order of left/right sides of lvalue sub assignment (2)";
44
45throws_ok {
46        my sub foo ($arg) is rw { die "second"; my $var };
47        foo(die "first") := die "third";
48}, "first", "evaluation order of left/right sides of lvalue sub binding (2)", :todo<bug>;
49
50throws_ok {
51        my @a = (die("first"), die("second"));
52}, "first", "evaluation order of list context (provided by assigning to an array)";
53
54throws_ok {
55        my $a = [die("first"), die("second")];
56}, "first", "evaluation order of list context (provided by creating an arrayref)";
57
58throws_ok {
59        my %a = (die("first"), die("second"));
60}, "first", "evaluation order of list context (provided by assigning to a hash)";
61
62throws_ok {
63        my $x = die("first"), die("second");
64}, "first", "evaluation order of multiple items in scalar context";
65
66throws_ok {
67        say(die("first"), die("second"));
68}, "first", "evaluation in function application";
69
70throws_ok {
71        die("first").say(die "second");
72}, "first", "evaluation in method application";
73
74throws_ok {
75        (die "first")(die "second");
76}, "first", "evaluation order of using (die()) as subref";
77
78throws_ok {
79        (die "first") += die "second";
80}, "first", "evaluation order of +=";
Note: See TracBrowser for help on using the browser.