X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan_tools%2Flibtap%2Ftests%2Ftodo%2Ftest.pl;fp=ccan_tools%2Flibtap%2Ftests%2Ftodo%2Ftest.pl;h=a1ae9dd3a734cf2d744e5dadbb8d7811b1716ac1;hp=0000000000000000000000000000000000000000;hb=7bbd49fdb03503688dd34ab860e0e02e852ed267;hpb=fdfcdafbfa7957b6ca393bb4000fbaad3813a61a diff --git a/ccan_tools/libtap/tests/todo/test.pl b/ccan_tools/libtap/tests/todo/test.pl new file mode 100644 index 00000000..a1ae9dd3 --- /dev/null +++ b/ccan_tools/libtap/tests/todo/test.pl @@ -0,0 +1,40 @@ +#!/usr/bin/perl + +use warnings; +use strict; + +use Test::More; + +my $rc = 0; + +plan tests => 5; + +my $side_effect = 0; # Check whether TODO has side effects + +$rc = ok(1 == 1, '1 equals 1'); # Test ok() passes when it should +diag("Returned: $rc"); + +# Start TODO tests +TODO: { + local $TODO = 'For testing purposes'; + + $side_effect++; + + # This test should fail + $rc = ok($side_effect == 0, 'side_effect checked out'); + diag("Returned: $rc"); + + # This test should unexpectedly succeed + $rc = ok($side_effect == 1, 'side_effect checked out'); + diag("Returned: $rc"); +} + +TODO: { + local $TODO = 'Testing printf() expansion in todo_start()'; + + $rc = ok(0, 'dummy test'); + diag("Returned: $rc"); +} + +$rc = ok($side_effect == 1, "side_effect is $side_effect"); +diag("Returned: $rc");