Cleanup the main regex in Text::ParseWords and make the
[p5sagit/p5-mst-13.2.git] / ext / Devel / PPPort / t / test.t
1 BEGIN {
2     chdir 't' if -d 't';
3     @INC = '../lib' if -d '../lib';
4     require Config;
5     if (($Config::Config{'extensions'} !~ /\bDevel::PPPort\b/) ){
6         print "1..0 # Skip -- Perl configured without Devel::PPPort module\n";
7         exit 0;
8     }
9 }
10
11 use Devel::PPPort;
12 use strict;
13
14 print "1..17\n";
15
16 my $total = 0;
17 my $good = 0;
18
19 my $test = 0;   
20 sub ok {
21     my ($name, $test_sub) = @_;
22     my $line = (caller)[2];
23     my $value;
24
25     eval { $value = &{ $test_sub }() } ;
26
27     ++ $test ;
28
29     if ($@) {
30         printf "not ok $test # Testing '$name', line $line $@\n";
31     }
32     elsif ($value != 1){
33         printf "not ok $test # Testing '$name', line $line, value != 1 ($value)\n";
34     }
35     else {
36         print "ok $test\n";
37     }
38
39
40
41 ok "Static newCONSTSUB()", 
42    sub { Devel::PPPort::test1(); Devel::PPPort::test_value_1() == 1} ;
43
44 ok "Global newCONSTSUB()", 
45    sub { Devel::PPPort::test2(); Devel::PPPort::test_value_2() == 2} ;
46
47 ok "Extern newCONSTSUB()", 
48    sub { Devel::PPPort::test3(); Devel::PPPort::test_value_3() == 3} ;
49
50 ok "newRV_inc()", sub { Devel::PPPort::test4()} ;
51
52 ok "newRV_noinc()", sub { Devel::PPPort::test5()} ;
53
54 ok "PL_sv_undef", sub { not defined Devel::PPPort::test6()} ;
55
56 ok "PL_sv_yes", sub { Devel::PPPort::test7()} ;
57
58 ok "PL_sv_no", sub { !Devel::PPPort::test8()} ;
59
60 ok "PL_na", sub { Devel::PPPort::test9("abcd") == 4} ;
61
62 ok "boolSV 1", sub { Devel::PPPort::test10(1) } ;
63
64 ok "boolSV 0", sub { ! Devel::PPPort::test10(0) } ;
65
66 ok "newSVpvn", sub { Devel::PPPort::test11("abcde", 3) eq "abc" } ;
67
68 ok "DEFSV", sub { $_ = "Fred"; Devel::PPPort::test12() eq "Fred" } ;
69
70 ok "ERRSV", sub { eval { 1; }; ! Devel::PPPort::test13() };
71
72 ok "ERRSV", sub { eval { fred() }; Devel::PPPort::test13() };
73
74 ok "CXT 1", sub { Devel::PPPort::test14()} ;
75
76 ok "CXT 2", sub { Devel::PPPort::test15()} ;
77
78 __END__
79 # TODO
80
81 PERL_VERSION
82 PERL_BCDVERSION
83
84 PL_stdingv
85 PL_hints
86 PL_curcop
87 PL_curstash
88 PL_copline
89 PL_Sv
90 PL_compiling
91 PL_dirty
92
93 PTR2IV
94 INT2PTR
95
96 dTHR
97 gv_stashpvn
98 NOOP
99 SAVE_DEFSV
100 PERL_UNUSED_DECL
101 dNOOP
102
103 call_argv
104 call_method
105 call_pv
106 call_sv
107
108 get_cv
109 get_av
110 get_hv
111 get_sv
112
113 grok_hex
114 grok_oct
115 grok_bin
116
117 grok_number
118 grok_numeric_radix