X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=dev%2Fi386%2Flibtest-simple-perl%2Flibtest-simple-perl-0.80%2Ft%2Ftodo.t;fp=dev%2Fi386%2Flibtest-simple-perl%2Flibtest-simple-perl-0.80%2Ft%2Ftodo.t;h=d589c926760af5bbbd65d3304ac5af70596d596e;hb=8977e561d8a9eae6959218b0306c9df2056a38a9;hp=0000000000000000000000000000000000000000;hpb=df794b845212301ea0d267c919232538bfef356a;p=dh-make-perl diff --git a/dev/i386/libtest-simple-perl/libtest-simple-perl-0.80/t/todo.t b/dev/i386/libtest-simple-perl/libtest-simple-perl-0.80/t/todo.t new file mode 100644 index 0000000..d589c92 --- /dev/null +++ b/dev/i386/libtest-simple-perl/libtest-simple-perl-0.80/t/todo.t @@ -0,0 +1,88 @@ +#!perl -w + +BEGIN { + if( $ENV{PERL_CORE} ) { + chdir 't'; + @INC = '../lib'; + } +} + +use Test::More; + +plan tests => 19; + + +$Why = 'Just testing the todo interface.'; + +my $is_todo; +TODO: { + local $TODO = $Why; + + fail("Expected failure"); + fail("Another expected failure"); + + $is_todo = Test::More->builder->todo; +} + +pass("This is not todo"); +ok( $is_todo, 'TB->todo' ); + + +TODO: { + local $TODO = $Why; + + fail("Yet another failure"); +} + +pass("This is still not todo"); + + +TODO: { + local $TODO = "testing that error messages don't leak out of todo"; + + ok( 'this' eq 'that', 'ok' ); + + like( 'this', '/that/', 'like' ); + is( 'this', 'that', 'is' ); + isnt( 'this', 'this', 'isnt' ); + + can_ok('Fooble', 'yarble'); + isa_ok('Fooble', 'yarble'); + use_ok('Fooble'); + require_ok('Fooble'); +} + + +TODO: { + todo_skip "Just testing todo_skip", 2; + + fail("Just testing todo"); + die "todo_skip should prevent this"; + pass("Again"); +} + + +{ + my $warning; + local $SIG{__WARN__} = sub { $warning = join "", @_ }; + TODO: { + # perl gets the line number a little wrong on the first + # statement inside a block. + 1 == 1; +#line 73 + todo_skip "Just testing todo_skip"; + fail("So very failed"); + } + is( $warning, "todo_skip() needs to know \$how_many tests are in the ". + "block at $0 line 73\n", + 'todo_skip without $how_many warning' ); +} + + +TODO: { + Test::More->builder->exported_to("Wibble"); + + local $TODO = "testing \$TODO with an incorrect exported_to()"; + + fail("Just testing todo"); +}