Cross Reference: fail.t
xref
: /
osnet-11
/
usr
/
src
/
cmd
/
perl
/
5.8.4
/
distrib
/
lib
/
Test
/
Simple
/
t
/
fail.t
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
1
N/A
#!perl -w
1
N/A
1
N/A
BEGIN
{
1
N/A
if
(
$ENV
{
PERL_CORE
} )
{
1
N/A
chdir
't'
;
1
N/A
@
INC
=
(
'../lib'
,
'lib'
)
;
1
N/A
}
1
N/A
else
{
1
N/A
unshift
@
INC
,
'
t
/
lib
'
;
1
N/A
}
1
N/A
}
1
N/A
1
N/A
use
strict
;
1
N/A
1
N/A
require
Test
::
Simple
::
Catch
;
1
N/A
my
(
$out
,
$err
)
=
Test
::
Simple
::
Catch
::
caught
()
;
1
N/A
1
N/A
1
N/A
# Can't use
Test.pm
, that's a 5.005 thing.
1
N/A
package
My
::
Test
;
1
N/A
1
N/A
print
"1..2\n"
;
1
N/A
1
N/A
my
$test_num
=
1
;
1
N/A
# Utility testing functions.
1
N/A
sub
ok
($;$)
{
1
N/A
my
(
$test
,
$name
)
= @_;
1
N/A
my
$ok
=
''
;
1
N/A
$ok
.=
"not "
unless
$test
;
1
N/A
$ok
.=
"ok
$test_num
"
;
1
N/A
$ok
.=
" -
$name
"
if
defined
$name
;
1
N/A
$ok
.=
"\n"
;
1
N/A
print
$ok
;
1
N/A
$test_num
++;
1
N/A
}
1
N/A
1
N/A
1
N/A
package
main
;
1
N/A
1
N/A
require
Test
::
Simple
;
1
N/A
Test
::
Simple
->
import
(
tests
=>
5
)
;
1
N/A
1
N/A
#line 35
1
N/A
ok
(
1
,
'passing'
)
;
1
N/A
ok
(
2
,
'passing still'
)
;
1
N/A
ok
(
3
,
'still passing'
)
;
1
N/A
ok
(
0
,
'oh no!'
)
;
1
N/A
ok
(
0
,
'damnit'
)
;
1
N/A
1
N/A
1
N/A
END
{
1
N/A
My
::
Test
::
ok
($
$out
eq
<<OUT
);
1
N/A
1..5
1
N/A
ok 1 - passing
1
N/A
ok 2 - passing still
1
N/A
ok 3 - still passing
1
N/A
not ok 4 - oh no!
1
N/A
not ok 5 - damnit
1
N/A
OUT
1
N/A
1
N/A
My
::
Test
::
ok
($
$err
eq
<<ERR
);
1
N/A
# Failed test ($0 at line 38)
1
N/A
# Failed test ($0 at line 39)
1
N/A
# Looks like you failed 2 tests of 5.
1
N/A
ERR
1
N/A
1
N/A
# Prevent Test::Simple from exiting with non zero
1
N/A
exit
0
;
1
N/A
}