https://github.com/mozilla/gecko-dev
Raw File
Tip revision: 7b0b5e8233ae391a003a8b0521864c19e43682a4 authored by tbirdbld on 13 July 2012, 21:08:40 UTC
Added THUNDERBIRD_14_0_RELEASE THUNDERBIRD_14_0_BUILD1 tag(s) for changeset 228ba1a111fc. DONTBUILD CLOSED TREE a=release
Tip revision: 7b0b5e8
gen_template.pl
#!/usr/bin/perl
#
#  gen_template.pl
#  Makes test case templates.
#  Takes two arguments:
#
#  -b : a bugnumber
#  -type : template type. {html|xhtml|xul}. defaults to html.  
#
#  perl gen_template.pl -b 345876 -type xul
#
#  sends a test case template for bug 345876 to stdout
use FindBin;
use Getopt::Long;
GetOptions("b=i"=> \$bug_number,
           "type:s"=> \$template_type);

if ($template_type eq "xul") {
  $template_type = "$FindBin::RealBin/static/xul.template.txt";
} elsif ($template_type eq "xhtml") {
  $template_type = "$FindBin::RealBin/static/xhtml.template.txt";
} elsif ($template_type eq "chrome") {
  $template_type = "$FindBin::RealBin/static/chrome.template.txt";
} else {
  $template_type = "$FindBin::RealBin/static/test.template.txt";
}

open(IN,$template_type) or die("Failed to open myfile for reading.");
while((defined(IN)) && ($line = <IN>)) {
        $line =~ s/{BUGNUMBER}/$bug_number/g;
        print STDOUT $line;
}
close(IN);
back to top