Commit | Line | Data |
---|---|---|
e2fe06dd EB |
1 | #!perl -w |
2 | ||
3 | BEGIN { | |
4 | push @INC, "::lib:$MacPerl::Architecture:" if $^O eq 'MacOS'; | |
5 | require Config; import Config; | |
6 | if ($Config{'extensions'} !~ /\bXS\/APItest\b/) { | |
7 | # Look, I'm using this fully-qualified variable more than once! | |
8 | my $arch = $MacPerl::Architecture; | |
9 | print "1..0 # Skip: XS::APItest was not built\n"; | |
10 | exit 0; | |
11 | } | |
12 | } | |
13 | ||
14 | use strict; | |
15 | use utf8; | |
16 | use Test::More tests => 5; | |
17 | ||
18 | BEGIN {use_ok('XS::APItest')}; | |
19 | ||
20 | sub make_temp_mg_lv :lvalue { XS::APItest::TempLv::make_temp_mg_lv($_[0]); } | |
21 | ||
22 | { | |
23 | my $x = "[]"; | |
24 | eval { XS::APItest::TempLv::make_temp_mg_lv($x) = "a"; }; | |
25 | is($@, '', 'temp mg lv from xs exception check'); | |
26 | is($x, '[a]', 'temp mg lv from xs success'); | |
27 | } | |
28 | ||
29 | { | |
30 | local $TODO = "PP lvalue sub can't return magical temp"; | |
31 | my $x = "{}"; | |
32 | eval { make_temp_mg_lv($x) = "b"; }; | |
33 | is($@, '', 'temp mg lv from pp exception check'); | |
34 | is($x, '{b}', 'temp mg lv from pp success'); | |
35 | } | |
36 | ||
37 | 1; |