Commit | Line | Data |
96ad942f |
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'; |
a745474a |
15 | if (" $Config{'extensions'} " !~ m[ Devel/PPPort ]) { |
96ad942f |
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 | |
c07deaaf |
24 | sub load { |
25 | eval "use Test"; |
26 | require 'testutil.pl' if $@; |
96ad942f |
27 | } |
c07deaaf |
28 | |
29 | if (9) { |
30 | load(); |
96ad942f |
31 | plan(tests => 9); |
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 | ok(&Devel::PPPort::vnewSVpvf(), $] >= 5.004 ? 'Perl-42' : '%s-%d'); |
46 | ok(&Devel::PPPort::sv_vcatpvf('1-2-3-'), $] >= 5.004 ? '1-2-3-Perl-42' : '1-2-3-%s-%d'); |
47 | ok(&Devel::PPPort::sv_vsetpvf('1-2-3-'), $] >= 5.004 ? 'Perl-42' : '%s-%d'); |
48 | |
49 | &Devel::PPPort::sv_catpvf_mg($h{foo}); |
50 | ok($h{foo}, $] >= 5.004 ? 'foo-Perl-42' : 'foo-'); |
51 | |
52 | &Devel::PPPort::Perl_sv_catpvf_mg($h{foo}); |
53 | ok($h{foo}, $] >= 5.004 ? 'foo-Perl-42-Perl-43' : 'foo-'); |
54 | |
55 | &Devel::PPPort::sv_catpvf_mg_nocontext($h{foo}); |
56 | ok($h{foo}, $] >= 5.004 ? 'foo-Perl-42-Perl-43-Perl-44' : 'foo-'); |
57 | |
58 | &Devel::PPPort::sv_setpvf_mg($h{bar}); |
59 | ok($h{bar}, $] >= 5.004 ? 'mhx-42' : ''); |
60 | |
61 | &Devel::PPPort::Perl_sv_setpvf_mg($h{bar}); |
62 | ok($h{bar}, $] >= 5.004 ? 'foo-43' : ''); |
63 | |
64 | &Devel::PPPort::sv_setpvf_mg_nocontext($h{bar}); |
65 | ok($h{bar}, $] >= 5.004 ? 'bar-44' : ''); |
66 | |