Upgrade to Devel::PPPort 3.10_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#
cac25305 7# This file was automatically generated from the definition files in the
8# parts/inc/ subdirectory by mktests.PL. To learn more about how all this
9# works, please read the F<HACKERS> file that came with this distribution.
10#
adfe19db 11################################################################################
12
13BEGIN {
14 if ($ENV{'PERL_CORE'}) {
15 chdir 't' if -d 't';
16 @INC = ('../lib', '../ext/Devel/PPPort/t') if -d '../lib' && -d '../ext';
17 require Config; import Config;
18 use vars '%Config';
a745474a 19 if (" $Config{'extensions'} " !~ m[ Devel/PPPort ]) {
adfe19db 20 print "1..0 # Skip -- Perl configured without Devel::PPPort module\n";
21 exit 0;
22 }
23 }
24 else {
25 unshift @INC, 't';
26 }
27
c07deaaf 28 sub load {
29 eval "use Test";
30 require 'testutil.pl' if $@;
adfe19db 31 }
c07deaaf 32
33 if (13) {
34 load();
f2ab5a41 35 plan(tests => 13);
adfe19db 36 }
37}
38
39use Devel::PPPort;
40use strict;
41$^W = 1;
42
236afa0a 43package Devel::PPPort;
44use vars '@ISA';
45require DynaLoader;
46@ISA = qw(DynaLoader);
47bootstrap Devel::PPPort;
48
49package main;
50
adfe19db 51use Tie::Hash;
52my %h;
53tie %h, 'Tie::StdHash';
54$h{foo} = 'foo';
55$h{bar} = '';
56
57&Devel::PPPort::sv_catpv_mg($h{foo}, 'bar');
58ok($h{foo}, 'foobar');
59
60&Devel::PPPort::sv_catpvn_mg($h{bar}, 'baz');
61ok($h{bar}, 'baz');
62
63&Devel::PPPort::sv_catsv_mg($h{foo}, '42');
64ok($h{foo}, 'foobar42');
65
66&Devel::PPPort::sv_setiv_mg($h{bar}, 42);
67ok($h{bar}, 42);
68
69&Devel::PPPort::sv_setnv_mg($h{PI}, 3.14159);
70ok(abs($h{PI} - 3.14159) < 0.01);
71
72&Devel::PPPort::sv_setpv_mg($h{mhx}, 'mhx');
73ok($h{mhx}, 'mhx');
74
75&Devel::PPPort::sv_setpvn_mg($h{mhx}, 'Marcus');
76ok($h{mhx}, 'Marcus');
77
78&Devel::PPPort::sv_setsv_mg($h{sv}, 'SV');
79ok($h{sv}, 'SV');
80
81&Devel::PPPort::sv_setuv_mg($h{sv}, 4711);
82ok($h{sv}, 4711);
83
84&Devel::PPPort::sv_usepvn_mg($h{sv}, 'Perl');
85ok($h{sv}, 'Perl');
86
f2ab5a41 87my $ver = eval qq[qv("v1.2.0")];
88ok($[ < 5.009 || $@ eq '');
89ok($@ || Devel::PPPort::SvVSTRING_mg($ver));
90ok(!Devel::PPPort::SvVSTRING_mg(4711));
91