1use warnings; 2use strict; 3 4use Test::More tests => 8; 5 6BEGIN { $^H |= 0x20000; } 7 8my $t; 9 10$t = ""; 11eval 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}; 19is $@, ""; 20is $t, "ab(3)c(4)d"; 21 22$t = ""; 23eval 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}; 31isnt $@, ""; 32is $t, ""; 33 34$t = ""; 35eval 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}; 44is $@, ""; 45is $t, "ab(3)c(4)d"; 46 47$t = ""; 48eval 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}; 57is $@, ""; 58is $t, "ab(0)c(1)d"; 59 601; 61