summaryrefslogtreecommitdiffstats
path: root/debian/perl-framework/Apache-Test/t/sok.t
blob: cb7efdbf60637b5c819ae0179b72f74e040ad380 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!perl

use strict;
use warnings FATAL=>'all';

use Test ();
use Config ();
unless ($Config::Config{useperlio}) {
    print "1..0 # need perlio\n";
    exit 0;
}

Test::plan tests=>8;

my $output;
{
    package X0;
    use Apache::Test;

    local ($Test::planned, $Test::ntest, %Test::todo);
    local *STDOUT;
    open STDOUT, '>', \$output;

    local $ENV{HTTPD_TEST_SUBTESTS}="";

    plan tests=>3;

    sok {1};
    sok {1};
    sok {1};
}
Test::ok $output=~/^ok 1$/m &&
         $output=~/^ok 2$/m &&
         $output=~/^ok 3$/m;

{
    package Y0;
    use Apache::Test qw/-withtestmore/;

    local *STDOUT;
    open STDOUT, '>', \$output;

    local $ENV{HTTPD_TEST_SUBTESTS}="";

    plan tests=>3;

    sok {1};
    sok {1};
    sok {1};
}
Test::ok $output=~/^ok 1$/m &&
         $output=~/^ok 2$/m &&
         $output=~/^ok 3$/m;

{
    package X0;

    local ($Test::planned, $Test::ntest, %Test::todo);
    local *STDOUT;
    open STDOUT, '>', \$output;

    local $ENV{HTTPD_TEST_SUBTESTS}="1 3";

    plan tests=>3;

    sok {1};
    sok {1};
    sok {1};
}
Test::ok $output=~/^ok 1$/m &&
         $output=~/^ok 2 # skip skipping this subtest$/mi &&
         $output=~/^ok 3$/m;

{
    package Y0;

    local *STDOUT;
    open STDOUT, '>', \$output;

    local $ENV{HTTPD_TEST_SUBTESTS}="1 3";

    plan tests=>3;

    sok {1};
    sok {1};
    sok {1};
}
Test::ok $output=~/^ok 1$/m &&
         $output=~/^ok 2 # skip skipping this subtest$/mi &&
         $output=~/^ok 3$/m;

{
    package X0;

    local ($Test::planned, $Test::ntest, %Test::todo);
    local *STDOUT;
    open STDOUT, '>', \$output;

    local $ENV{HTTPD_TEST_SUBTESTS}="";

    plan tests=>4;

    sok {1};
    sok {ok 1; 1} 2;
    sok {1};
}
Test::ok $output=~/^ok 1$/m &&
         $output=~/^ok 2$/m &&
         $output=~/^ok 3$/m &&
         $output=~/^ok 4$/m;

{
    package Y0;

    local *STDOUT;
    open STDOUT, '>', \$output;

    local $ENV{HTTPD_TEST_SUBTESTS}="";

    plan tests=>4;

    sok {1};
    sok {ok 1, "erwin"} 2;
    sok {1};
}
Test::ok $output=~/^ok 1$/m &&
         $output=~/^ok 2 - erwin$/m &&
         $output=~/^ok 3$/m &&
         $output=~/^ok 4$/m;

{
    package X0;

    local ($Test::planned, $Test::ntest, %Test::todo);
    local *STDOUT;
    open STDOUT, '>', \$output;

    local $ENV{HTTPD_TEST_SUBTESTS}="1 4";

    plan tests=>4;

    sok {1};
    sok {ok 1; 1} 2;
    sok {1};
}
Test::ok $output=~/^ok 1$/m &&
         $output=~/^ok 2 # skip skipping this subtest$/mi &&
         $output=~/^ok 3 # skip skipping this subtest$/mi &&
         $output=~/^ok 4$/m;

{
    package Y0;

    local *STDOUT;
    open STDOUT, '>', \$output;

    local $ENV{HTTPD_TEST_SUBTESTS}="1 4";

    plan tests=>4;

    sok {1};
    sok {ok 1} 2;
    sok {1};
}
Test::ok $output=~/^ok 1$/m &&
         $output=~/^ok 2 # skip skipping this subtest$/mi &&
         $output=~/^ok 3 # skip skipping this subtest$/mi &&
         $output=~/^ok 4$/m;