Commit | Line | Data |
---|---|---|
3ad73efd Z |
1 | use warnings; |
2 | use strict; | |
3 | ||
4 | use Test::More tests => 8; | |
5 | ||
6 | BEGIN { $^H |= 0x20000; } | |
7 | ||
8 | my $t; | |
9 | ||
10 | $t = ""; | |
11 | eval q{ | |
12 | use XS::APItest qw(postinc); | |
13 | $t .= "a"; | |
14 | my $x = 3; | |
15 | $t .= "b(".postinc($x).")"; | |
16 | $t .= "c(".$x.")"; | |
17 | $t .= "d"; | |
18 | }; | |
19 | is $@, ""; | |
20 | is $t, "ab(3)c(4)d"; | |
21 | ||
22 | $t = ""; | |
23 | eval q{ | |
24 | use XS::APItest qw(postinc); | |
25 | $t .= "a"; | |
26 | my $x = 3; | |
27 | $t .= "b(".postinc($x+1).")"; | |
28 | $t .= "c(".$x.")"; | |
29 | $t .= "d"; | |
30 | }; | |
31 | isnt $@, ""; | |
32 | is $t, ""; | |
33 | ||
34 | $t = ""; | |
35 | eval q{ | |
36 | use XS::APItest qw(postinc); | |
37 | $t .= "a"; | |
38 | my %x = (z => 3); | |
39 | my $z = postinc($x{z}); | |
40 | $t .= "b(".$z.")"; | |
41 | $t .= "c(".$x{z}.")"; | |
42 | $t .= "d"; | |
43 | }; | |
44 | is $@, ""; | |
45 | is $t, "ab(3)c(4)d"; | |
46 | ||
47 | $t = ""; | |
48 | eval q{ | |
49 | use XS::APItest qw(postinc); | |
50 | $t .= "a"; | |
51 | my %x; | |
52 | my $z = postinc($x{z}); | |
53 | $t .= "b(".$z.")"; | |
54 | $t .= "c(".$x{z}.")"; | |
55 | $t .= "d"; | |
56 | }; | |
57 | is $@, ""; | |
58 | is $t, "ab(0)c(1)d"; | |
59 | ||
60 | 1; |