summaryrefslogtreecommitdiff
path: root/unittest/examples/no_plan-t.c
diff options
context:
space:
mode:
Diffstat (limited to 'unittest/examples/no_plan-t.c')
-rw-r--r--unittest/examples/no_plan-t.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/unittest/examples/no_plan-t.c b/unittest/examples/no_plan-t.c
new file mode 100644
index 00000000000..98e4d06def6
--- /dev/null
+++ b/unittest/examples/no_plan-t.c
@@ -0,0 +1,21 @@
+
+#include "my_config.h"
+
+#include <stdlib.h>
+#include <tap.h>
+
+/*
+ Sometimes, the number of tests is not known beforehand. In those
+ cases, the plan can be omitted and will instead be written at the
+ end of the test (inside exit_status()).
+
+ Use this sparingly, it is a last resort: planning how many tests you
+ are going to run will help you catch that offending case when some
+ tests are skipped for an unknown reason.
+*/
+int main() {
+ ok(1, NULL);
+ ok(1, NULL);
+ ok(1, NULL);
+ return exit_status();
+}