Upgrade to Devel::PPPort 3.00_01.
[p5sagit/p5-mst-13.2.git] / ext / Devel / PPPort / t / sv_xpvf.t
1 ################################################################################
2 #
3 #            !!!!!   Do NOT edit this file directly!   !!!!!
4 #
5 #            Edit mktests.PL and/or parts/inc/sv_xpvf 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..9\n";
28   }
29   else {
30     plan(tests => 9);
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 ok(&Devel::PPPort::vnewSVpvf(), $] >= 5.004 ? 'Perl-42' : '%s-%d');
45 ok(&Devel::PPPort::sv_vcatpvf('1-2-3-'), $] >= 5.004 ? '1-2-3-Perl-42' : '1-2-3-%s-%d');
46 ok(&Devel::PPPort::sv_vsetpvf('1-2-3-'), $] >= 5.004 ? 'Perl-42' : '%s-%d');
47
48 &Devel::PPPort::sv_catpvf_mg($h{foo});
49 ok($h{foo}, $] >= 5.004 ? 'foo-Perl-42' : 'foo-');
50
51 &Devel::PPPort::Perl_sv_catpvf_mg($h{foo});
52 ok($h{foo}, $] >= 5.004 ? 'foo-Perl-42-Perl-43' : 'foo-');
53
54 &Devel::PPPort::sv_catpvf_mg_nocontext($h{foo});
55 ok($h{foo}, $] >= 5.004 ? 'foo-Perl-42-Perl-43-Perl-44' : 'foo-');
56
57 &Devel::PPPort::sv_setpvf_mg($h{bar});
58 ok($h{bar}, $] >= 5.004 ? 'mhx-42' : '');
59
60 &Devel::PPPort::Perl_sv_setpvf_mg($h{bar});
61 ok($h{bar}, $] >= 5.004 ? 'foo-43' : '');
62
63 &Devel::PPPort::sv_setpvf_mg_nocontext($h{bar});
64 ok($h{bar}, $] >= 5.004 ? 'bar-44' : '');
65