]> git.ozlabs.org Git - ccan/blobdiff - ccan_tools/libtap/tests/todo/test.pl
Include all the tools under ccan_tools dir, hacked to work for me.
[ccan] / ccan_tools / libtap / tests / todo / test.pl
diff --git a/ccan_tools/libtap/tests/todo/test.pl b/ccan_tools/libtap/tests/todo/test.pl
new file mode 100644 (file)
index 0000000..a1ae9dd
--- /dev/null
@@ -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");