]> granicus.if.org Git - apache/blob - build/httpdunit_gen_stubs.pl
update after backport
[apache] / build / httpdunit_gen_stubs.pl
1 #! /usr/bin/env perl
2
3 #
4 # Generates a code stub that adds unit tests to a Check test case.
5 #
6 # Supply the test case's source file contents on stdin; the resulting code will
7 # be printed to stdout. This code is designed to be included as part of the
8 # boilerplate at the end of each test case.
9 #
10
11 use strict;
12 use warnings;
13
14 while (my $line = <>) {
15     # FIXME: this does not correctly handle macro invocations that are split
16     # over multiple lines.
17     if ($line =~ /^HTTPD_START_LOOP_TEST\((\w+),(.*)\)/) {
18         print "tcase_add_loop_test(testcase, $1, 0, ($2));\n";
19     } elsif ($line =~ /^START_TEST\((\w+)\)/) {
20         print "tcase_add_test(testcase, $1);\n"
21     }
22 }