summaryrefslogtreecommitdiff
path: root/build/httpdunit_gen_cases.pl
blob: a40d12c773d28b241c594ca42403b3fe62268db8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#! /usr/bin/env perl

#
# Generates a list of test cases to be pulled into the httpdunit main test
# suite.
#
# Supply all the test cases' source file contents on stdin; the resulting code
# will be printed to stdout. Normally you will want to call this twice: once
# with --declaration to print the function declarations of all the test cases,
# and once without any options to produce the code that actually adds each test
# case to the main suite.
#

use strict;
use warnings;

while (my $line = <>) {
    if ($line =~ /^HTTPD_BEGIN_TEST_CASE(?:\w+)?\((\w+)/) {
        my $name = "$1_test_case";
        print "TCase *$name(void); ";
        print "suite_add_tcase(suite, $name());\n";
    }
}