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

#
# Generates a code stub that adds unit tests to a Check test case.
#
# Supply the test case's source file contents on stdin; the resulting code will
# be printed to stdout. This code is designed to be included as part of the
# boilerplate at the end of each test case.
#

use strict;
use warnings;

while (my $line = <>) {
    # FIXME: this does not correctly handle macro invocations that are split
    # over multiple lines.
    if ($line =~ /^HTTPD_START_LOOP_TEST\((\w+),(.*)\)/) {
        print "tcase_add_loop_test(testcase, $1, 0, ($2));\n";
    } elsif ($line =~ /^START_TEST\((\w+)\)/) {
        print "tcase_add_test(testcase, $1);\n"
    }
}