Commit | Line | Data |
---|---|---|
adfe19db MHM |
1 | ################################################################################ |
2 | # | |
3 | # !!!!! Do NOT edit this file directly! !!!!! | |
4 | # | |
5 | # Edit mktests.PL and/or parts/inc/SvPV instead. | |
6 | # | |
cac25305 MHM |
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 MHM |
11 | ################################################################################ |
12 | ||
13 | BEGIN { | |
14 | if ($ENV{'PERL_CORE'}) { | |
15 | chdir 't' if -d 't'; | |
0ff33da8 | 16 | @INC = ('../lib', '../ext/Devel-PPPort/t') if -d '../lib' && -d '../ext'; |
adfe19db MHM |
17 | require Config; import Config; |
18 | use vars '%Config'; | |
a745474a | 19 | if (" $Config{'extensions'} " !~ m[ Devel/PPPort ]) { |
adfe19db MHM |
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 MHM |
28 | sub load { |
29 | eval "use Test"; | |
30 | require 'testutil.pl' if $@; | |
adfe19db | 31 | } |
c07deaaf | 32 | |
c01be2ce | 33 | if (47) { |
c07deaaf | 34 | load(); |
c01be2ce | 35 | plan(tests => 47); |
adfe19db MHM |
36 | } |
37 | } | |
38 | ||
39 | use Devel::PPPort; | |
40 | use strict; | |
41 | $^W = 1; | |
42 | ||
236afa0a MHM |
43 | package Devel::PPPort; |
44 | use vars '@ISA'; | |
45 | require DynaLoader; | |
46 | @ISA = qw(DynaLoader); | |
47 | bootstrap Devel::PPPort; | |
48 | ||
49 | package main; | |
50 | ||
679ad62d MHM |
51 | my $mhx = "mhx"; |
52 | ||
53 | ok(&Devel::PPPort::SvPVbyte($mhx), 3); | |
54 | ||
55 | my $i = 42; | |
56 | ||
57 | ok(&Devel::PPPort::SvPV_nolen($mhx), $i++); | |
58 | ok(&Devel::PPPort::SvPV_const($mhx), $i++); | |
59 | ok(&Devel::PPPort::SvPV_mutable($mhx), $i++); | |
60 | ok(&Devel::PPPort::SvPV_flags($mhx), $i++); | |
61 | ok(&Devel::PPPort::SvPV_flags_const($mhx), $i++); | |
62 | ||
63 | ok(&Devel::PPPort::SvPV_flags_const_nolen($mhx), $i++); | |
64 | ok(&Devel::PPPort::SvPV_flags_mutable($mhx), $i++); | |
65 | ok(&Devel::PPPort::SvPV_force($mhx), $i++); | |
66 | ok(&Devel::PPPort::SvPV_force_nolen($mhx), $i++); | |
67 | ok(&Devel::PPPort::SvPV_force_mutable($mhx), $i++); | |
68 | ||
69 | ok(&Devel::PPPort::SvPV_force_nomg($mhx), $i++); | |
70 | ok(&Devel::PPPort::SvPV_force_nomg_nolen($mhx), $i++); | |
71 | ok(&Devel::PPPort::SvPV_force_flags($mhx), $i++); | |
72 | ok(&Devel::PPPort::SvPV_force_flags_nolen($mhx), $i++); | |
73 | ok(&Devel::PPPort::SvPV_force_flags_mutable($mhx), $i++); | |
74 | ||
75 | ok(&Devel::PPPort::SvPV_nolen_const($mhx), $i++); | |
76 | ok(&Devel::PPPort::SvPV_nomg($mhx), $i++); | |
77 | ok(&Devel::PPPort::SvPV_nomg_const($mhx), $i++); | |
78 | ok(&Devel::PPPort::SvPV_nomg_const_nolen($mhx), $i++); | |
adfe19db | 79 | |
8d2082b0 MHM |
80 | $mhx = 42; ok(&Devel::PPPort::SvPV_nolen($mhx), 0); |
81 | $mhx = 42; ok(&Devel::PPPort::SvPV_const($mhx), 2); | |
82 | $mhx = 42; ok(&Devel::PPPort::SvPV_mutable($mhx), 2); | |
83 | $mhx = 42; ok(&Devel::PPPort::SvPV_flags($mhx), 2); | |
84 | $mhx = 42; ok(&Devel::PPPort::SvPV_flags_const($mhx), 2); | |
85 | ||
86 | $mhx = 42; ok(&Devel::PPPort::SvPV_flags_const_nolen($mhx), 0); | |
87 | $mhx = 42; ok(&Devel::PPPort::SvPV_flags_mutable($mhx), 2); | |
88 | $mhx = 42; ok(&Devel::PPPort::SvPV_force($mhx), 2); | |
89 | $mhx = 42; ok(&Devel::PPPort::SvPV_force_nolen($mhx), 0); | |
90 | $mhx = 42; ok(&Devel::PPPort::SvPV_force_mutable($mhx), 2); | |
91 | ||
92 | $mhx = 42; ok(&Devel::PPPort::SvPV_force_nomg($mhx), 2); | |
93 | $mhx = 42; ok(&Devel::PPPort::SvPV_force_nomg_nolen($mhx), 0); | |
94 | $mhx = 42; ok(&Devel::PPPort::SvPV_force_flags($mhx), 2); | |
95 | $mhx = 42; ok(&Devel::PPPort::SvPV_force_flags_nolen($mhx), 0); | |
96 | $mhx = 42; ok(&Devel::PPPort::SvPV_force_flags_mutable($mhx), 2); | |
97 | ||
98 | $mhx = 42; ok(&Devel::PPPort::SvPV_nolen_const($mhx), 0); | |
99 | $mhx = 42; ok(&Devel::PPPort::SvPV_nomg($mhx), 2); | |
100 | $mhx = 42; ok(&Devel::PPPort::SvPV_nomg_const($mhx), 2); | |
101 | $mhx = 42; ok(&Devel::PPPort::SvPV_nomg_const_nolen($mhx), 0); | |
102 | ||
c01be2ce | 103 | my $str = ""; |
90b0dc0e | 104 | &Devel::PPPort::SvPV_force($str); |
c01be2ce MHM |
105 | my($s2, $before, $after) = &Devel::PPPort::SvPV_renew($str, 81, "x"x80); |
106 | ok($str, "x"x80); | |
107 | ok($s2, "x"x80); | |
108 | ok($before < 81); | |
109 | ok($after, 81); | |
110 | ||
111 | $str = "x"x400; | |
90b0dc0e | 112 | &Devel::PPPort::SvPV_force($str); |
c01be2ce MHM |
113 | ($s2, $before, $after) = &Devel::PPPort::SvPV_renew($str, 41, "x"x40); |
114 | ok($str, "x"x40); | |
115 | ok($s2, "x"x40); | |
116 | ok($before > 41); | |
117 | ok($after, 41); | |
118 |