Upgrade to Devel::PPPort 3.08_01
[p5sagit/p5-mst-13.2.git] / ext / Devel / PPPort / t / magic.t
CommitLineData
adfe19db 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';
a745474a 15 if (" $Config{'extensions'} " !~ m[ Devel/PPPort ]) {
adfe19db 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';
f2ab5a41 27 print "1..13\n";
adfe19db 28 }
29 else {
f2ab5a41 30 plan(tests => 13);
adfe19db 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
f2ab5a41 74my $ver = eval qq[qv("v1.2.0")];
75ok($[ < 5.009 || $@ eq '');
76ok($@ || Devel::PPPort::SvVSTRING_mg($ver));
77ok(!Devel::PPPort::SvVSTRING_mg(4711));
78