Upgrade to Devel::PPPort 3.08_02
[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   sub load {
25     eval "use Test";
26     require 'testutil.pl' if $@;
27   }
28
29   if (13) {
30     load();
31     plan(tests => 13);
32   }
33 }
34
35 use Devel::PPPort;
36 use strict;
37 $^W = 1;
38
39 use Tie::Hash;
40 my %h;
41 tie %h, 'Tie::StdHash';
42 $h{foo} = 'foo';
43 $h{bar} = '';
44
45 &Devel::PPPort::sv_catpv_mg($h{foo}, 'bar');
46 ok($h{foo}, 'foobar');
47
48 &Devel::PPPort::sv_catpvn_mg($h{bar}, 'baz');
49 ok($h{bar}, 'baz');
50
51 &Devel::PPPort::sv_catsv_mg($h{foo}, '42');
52 ok($h{foo}, 'foobar42');
53
54 &Devel::PPPort::sv_setiv_mg($h{bar}, 42);
55 ok($h{bar}, 42);
56
57 &Devel::PPPort::sv_setnv_mg($h{PI}, 3.14159);
58 ok(abs($h{PI} - 3.14159) < 0.01);
59
60 &Devel::PPPort::sv_setpv_mg($h{mhx}, 'mhx');
61 ok($h{mhx}, 'mhx');
62
63 &Devel::PPPort::sv_setpvn_mg($h{mhx}, 'Marcus');
64 ok($h{mhx}, 'Marcus');
65
66 &Devel::PPPort::sv_setsv_mg($h{sv}, 'SV');
67 ok($h{sv}, 'SV');
68
69 &Devel::PPPort::sv_setuv_mg($h{sv}, 4711);
70 ok($h{sv}, 4711);
71
72 &Devel::PPPort::sv_usepvn_mg($h{sv}, 'Perl');
73 ok($h{sv}, 'Perl');
74
75 my $ver = eval qq[qv("v1.2.0")];
76 ok($[ < 5.009 || $@ eq '');
77 ok($@ || Devel::PPPort::SvVSTRING_mg($ver));
78 ok(!Devel::PPPort::SvVSTRING_mg(4711));
79