1################################################################################ 2# 3# !!!!! Do NOT edit this file directly! !!!!! 4# 5# Edit mktests.PL and/or parts/inc/magic instead. 6# 7################################################################################ 8 9BEGIN { 10 if ($ENV{'PERL_CORE'}) { 11 chdir 't' if -d 't'; 12 @INC = ('../lib', '../ext/Devel/PPPort/t') if -d '../lib' && -d '../ext'; 13 require Config; import Config; 14 use vars '%Config'; 15 if (" $Config{'extensions'} " !~ m[ Devel/PPPort ]) { 16 print "1..0 # Skip -- Perl configured without Devel::PPPort module\n"; 17 exit 0; 18 } 19 } 20 else { 21 unshift @INC, 't'; 22 } 23 24 eval "use Test"; 25 if ($@) { 26 require 'testutil.pl'; 27 print "1..10\n"; 28 } 29 else { 30 plan(tests => 10); 31 } 32} 33 34use Devel::PPPort; 35use strict; 36$^W = 1; 37 38use Tie::Hash; 39my %h; 40tie %h, 'Tie::StdHash'; 41$h{foo} = 'foo'; 42$h{bar} = ''; 43 44&Devel::PPPort::sv_catpv_mg($h{foo}, 'bar'); 45ok($h{foo}, 'foobar'); 46 47&Devel::PPPort::sv_catpvn_mg($h{bar}, 'baz'); 48ok($h{bar}, 'baz'); 49 50&Devel::PPPort::sv_catsv_mg($h{foo}, '42'); 51ok($h{foo}, 'foobar42'); 52 53&Devel::PPPort::sv_setiv_mg($h{bar}, 42); 54ok($h{bar}, 42); 55 56&Devel::PPPort::sv_setnv_mg($h{PI}, 3.14159); 57ok(abs($h{PI} - 3.14159) < 0.01); 58 59&Devel::PPPort::sv_setpv_mg($h{mhx}, 'mhx'); 60ok($h{mhx}, 'mhx'); 61 62&Devel::PPPort::sv_setpvn_mg($h{mhx}, 'Marcus'); 63ok($h{mhx}, 'Marcus'); 64 65&Devel::PPPort::sv_setsv_mg($h{sv}, 'SV'); 66ok($h{sv}, 'SV'); 67 68&Devel::PPPort::sv_setuv_mg($h{sv}, 4711); 69ok($h{sv}, 4711); 70 71&Devel::PPPort::sv_usepvn_mg($h{sv}, 'Perl'); 72ok($h{sv}, 'Perl'); 73 74