Upgrade to Devel::PPPort 3.08_01
[p5sagit/p5-mst-13.2.git] / ext / Devel / PPPort / t / magic.t
1 ################################################################################
2 #
3 #            !!!!!   Do NOT edit this file directly!   !!!!!
4 #
5 #            Edit mktests.PL and/or parts/inc/magic instead.
6 #
7 ################################################################################
8
9 BEGIN {
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..13\n";
28   }
29   else {
30     plan(tests => 13);
31   }
32 }
33
34 use Devel::PPPort;
35 use strict;
36 $^W = 1;
37
38 use Tie::Hash;
39 my %h;
40 tie %h, 'Tie::StdHash';
41 $h{foo} = 'foo';
42 $h{bar} = '';
43
44 &Devel::PPPort::sv_catpv_mg($h{foo}, 'bar');
45 ok($h{foo}, 'foobar');
46
47 &Devel::PPPort::sv_catpvn_mg($h{bar}, 'baz');
48 ok($h{bar}, 'baz');
49
50 &Devel::PPPort::sv_catsv_mg($h{foo}, '42');
51 ok($h{foo}, 'foobar42');
52
53 &Devel::PPPort::sv_setiv_mg($h{bar}, 42);
54 ok($h{bar}, 42);
55
56 &Devel::PPPort::sv_setnv_mg($h{PI}, 3.14159);
57 ok(abs($h{PI} - 3.14159) < 0.01);
58
59 &Devel::PPPort::sv_setpv_mg($h{mhx}, 'mhx');
60 ok($h{mhx}, 'mhx');
61
62 &Devel::PPPort::sv_setpvn_mg($h{mhx}, 'Marcus');
63 ok($h{mhx}, 'Marcus');
64
65 &Devel::PPPort::sv_setsv_mg($h{sv}, 'SV');
66 ok($h{sv}, 'SV');
67
68 &Devel::PPPort::sv_setuv_mg($h{sv}, 4711);
69 ok($h{sv}, 4711);
70
71 &Devel::PPPort::sv_usepvn_mg($h{sv}, 'Perl');
72 ok($h{sv}, 'Perl');
73
74 my $ver = eval qq[qv("v1.2.0")];
75 ok($[ < 5.009 || $@ eq '');
76 ok($@ || Devel::PPPort::SvVSTRING_mg($ver));
77 ok(!Devel::PPPort::SvVSTRING_mg(4711));
78