Integrate mainline (ok linux)
[p5sagit/p5-mst-13.2.git] / ext / Devel / PPPort / t / test.t
CommitLineData
44284200 1
2use Devel::PPPort;
3
4use strict;
5
6print "1..17\n";
7
8BEGIN {
9 chdir 't' if -d 't';
10 @INC = '../lib' if -d '../lib';
11
12}
13
14my $total = 0;
15my $good = 0;
16
17my $test = 0;
18sub ok {
19 my ($name, $test_sub) = @_;
20 my $line = (caller)[2];
21 my $value;
22
23 eval { $value = &{ $test_sub }() } ;
24
25 ++ $test ;
26
27 if ($@) {
28 printf "not ok $test # Testing '$name', line $line $@\n";
29 }
30 elsif ($value != 1){
31 printf "not ok $test # Testing '$name', line $line, value != 1 ($value)\n";
32 }
33 else {
34 print "ok $test\n";
35 }
36
37}
38
39ok "Static newCONSTSUB()",
40 sub { Devel::PPPort::test1(); Devel::PPPort::test_value_1() == 1} ;
41
42ok "Global newCONSTSUB()",
43 sub { Devel::PPPort::test2(); Devel::PPPort::test_value_2() == 2} ;
44
45ok "Extern newCONSTSUB()",
46 sub { Devel::PPPort::test3(); Devel::PPPort::test_value_3() == 3} ;
47
48ok "newRV_inc()", sub { Devel::PPPort::test4()} ;
49
50ok "newRV_noinc()", sub { Devel::PPPort::test5()} ;
51
52ok "PL_sv_undef", sub { not defined Devel::PPPort::test6()} ;
53
54ok "PL_sv_yes", sub { Devel::PPPort::test7()} ;
55
56ok "PL_sv_no", sub { !Devel::PPPort::test8()} ;
57
58ok "PL_na", sub { Devel::PPPort::test9("abcd") == 4} ;
59
60ok "boolSV 1", sub { Devel::PPPort::test10(1) } ;
61
62ok "boolSV 0", sub { ! Devel::PPPort::test10(0) } ;
63
64ok "newSVpvn", sub { Devel::PPPort::test11("abcde", 3) eq "abc" } ;
65
66ok "DEFSV", sub { $_ = "Fred"; Devel::PPPort::test12() eq "Fred" } ;
67
68ok "ERRSV", sub { eval { 1; }; ! Devel::PPPort::test13() };
69
70ok "ERRSV", sub { eval { fred() }; Devel::PPPort::test13() };
71
72ok "CXT 1", sub { Devel::PPPort::test14()} ;
73
74ok "CXT 2", sub { Devel::PPPort::test15()} ;
75
76__END__
77# TODO
78
79PERL_VERSION
80PERL_BCDVERSION
81
82PL_stdingv
83PL_hints
84PL_curcop
85PL_curstash
86PL_copline
87PL_Sv
88PL_compiling
89PL_dirty
90
91PTR2IV
92INT2PTR
93
94dTHR
95gv_stashpvn
96NOOP
97SAVE_DEFSV
98PERL_UNUSED_DECL
99dNOOP