Commit | Line | Data |
0d0f8426 |
1 | ################################################################################ |
2 | # |
3 | # !!!!! Do NOT edit this file directly! !!!!! |
4 | # |
5 | # Edit mktests.PL and/or parts/inc/Sv_set 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'; |
f2ab5a41 |
27 | print "1..5\n"; |
0d0f8426 |
28 | } |
29 | else { |
f2ab5a41 |
30 | plan(tests => 5); |
0d0f8426 |
31 | } |
32 | } |
33 | |
34 | use Devel::PPPort; |
35 | use strict; |
36 | $^W = 1; |
37 | |
38 | my $foo = 5; |
39 | ok(&Devel::PPPort::TestSvUV_set($foo, 12345), 42); |
40 | ok(&Devel::PPPort::TestSvPVX_const("mhx"), 43); |
41 | ok(&Devel::PPPort::TestSvPVX_mutable("mhx"), 44); |
42 | |
f2ab5a41 |
43 | my $bar = []; |
44 | |
45 | bless $bar, 'foo'; |
46 | ok($bar->x(), 'foobar'); |
47 | |
48 | Devel::PPPort::TestSvSTASH_set($bar, 'bar'); |
49 | ok($bar->x(), 'hacker'); |
50 | |
51 | package foo; |
52 | |
53 | sub x { 'foobar' } |
54 | |
55 | package bar; |
56 | |
57 | sub x { 'hacker' } |
58 | |