-
Notifications
You must be signed in to change notification settings - Fork 0
/
output.t
167 lines (138 loc) · 4.26 KB
/
output.t
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
#!/usr/bin/perl
use warnings FATAL => 'all';
use strict;
use Test::Builder::Tester tests => 25;
use Test::Functional;
use Test::More;
sub mytest_fail {
my ($offset, $msg, $name) = @_;
$name ||= 'test';
my ($pkg, $file, $line) = caller();
$line += $offset || 0;
$msg ||= '';
my $err = <<ERR;
# Failed test '$name'
# at $file line $line.
$msg
ERR
$err =~ s#\n+$##;
@_ = ($err);
goto &test_err;
}
test_out("not ok 1 - test");
mytest_fail(1, "# died: Died at t/output.t line 26.");
test { die } "test";
test_test("die");
test_out("not ok 1 - test");
mytest_fail(1, "# got: '33'\n" . "# expected: '34'");
test { 33 } 34, "test";
test_test("eqv");
test_out("not ok 1 - test");
mytest_fail(1, "# died: Died at t/output.t line 36.");
test { die } 34, "test";
test_test("eqv-die");
test_out("not ok 1 - test");
mytest_fail(1, "# objects were the same");
test { 33 } ineqv(33), "test";
test_test("ineqv");
test_out("not ok 1 - test");
mytest_fail(1, "# died: Died at t/output.t line 46.");
test { die } ineqv(33), "test";
test_test("ineqv-die");
test_out("not ok 1 - test");
mytest_fail(1, "# result was not of type ARRAY");
test { sub{} } typeqv('ARRAY'), "test";
test_test("typeqv");
test_out("not ok 1 - test");
mytest_fail(1, "# result was undef");
test { undef } typeqv('ARRAY'), "test";
test_test("typeqv-undef");
test_out("not ok 1 - test");
mytest_fail(1, "# result was not a ref");
test { 33 } typeqv('ARRAY'), "test";
test_test("typeqv-noref");
test_out("not ok 1 - test");
mytest_fail(1, "# died: Died at t/output.t line 66.");
test { die } typeqv('ARRAY'), "test";
test_test("typeqv-die");
test_out("not ok 1 - test");
mytest_fail(1, "# failed to die");
test { 33 } dies, "test";
test_test("dies");
test_out("not ok 1 - test");
mytest_fail(1, "# died: Died at t/output.t line 76.");
test { die } noop, "test";
test_test("noop-die");
test_out("not ok 1 - test");
mytest_fail(1);
test { 0 } true, "test";
test_test("true");
test_out("not ok 1 - test");
mytest_fail(1, "# died: Died at t/output.t line 86.");
test { die } true, "test";
test_test("true-die");
test_out("not ok 1 - test");
mytest_fail(1);
test { 1 } false, "test";
test_test("false");
test_out("not ok 1 - test");
mytest_fail(1, "# died: Died at t/output.t line 96.");
test { die } false, "test";
test_test("false-die");
test_out("not ok 1 - test");
mytest_fail(1);
test { undef } isdef, "test";
test_test("isdef");
test_out("not ok 1 - test");
mytest_fail(1, "# died: Died at t/output.t line 106.");
test { die } isdef, "test";
test_test("isdef-die");
test_out("not ok 1 - test");
mytest_fail(1);
test { 1 } isundef, "test";
test_test("isundef");
test_out("not ok 1 - test");
mytest_fail(1, "# died: Died at t/output.t line 116.");
test { die } isundef, "test";
test_test("isundef-die");
test_out("not ok 1 - test");
mytest_fail(1, "# 'bar'\n# doesn't match '(?-xism:foo)'");
test { 'bar' } sub { like($_[0], qr/foo/, $_[1]) }, "test";
test_test("custom");
test_out("not ok 1 - test");
mytest_fail(1, "# died: Died at t/output.t line 126.");
test { die } sub { like($_[0], qr/foo/, $_[1]) }, "test";
test_test("custom-die");
test_out("not ok 1 - grp.test");
mytest_fail(2, "# got: '8'\n# expected: '34'", 'grp.test');
group {
pretest { 8 } 34, "test";
test { 19 } 19, "test2";
} "grp";
test_test("pretest");
test_out("not ok 1 - grp.test");
mytest_fail(2, "# died: Died at t/output.t line 140.", 'grp.test');
group {
pretest { die } 34, "test";
test { 19 } 19, "test2"
} "grp";
test_test("pretest");
test_out("ok 1 # skip test");
notest { 19 } 88, "test";
test_test("notest-stable");
Test::Functional::configure(unstable => 1, fastout => 0);
test_out("not ok 1 - test");
mytest_fail(1, "# got: '19'\n# expected: '88'");
notest { 19 } 88, "test";
test_test("notest-unstable");
# there is a bug with Test::Builder::Tester that means that when
# Test::Functional calls $t->BAIL_OUT() it causes THIS test to exit. ugh.
#Test::Functional::configure(unstable => 0, fastout => 1);
#
#test_out("not ok 1 - grp.test");
#mytest_fail(2, "# got: '8'\n# expected: '34'", 'grp.test');
#group {
# test { 8 } 34, "test";
# test { 19 } 19, "test2";
#} "grp";
#test_test("fastout");