testing/mochitest/gen_template.pl
author roc+@cs.cmu.edu
Tue, 29 May 2007 02:45:30 -0700
changeset 1938 2cf6bf8e3792adc54877ada0dd9bfb0fed805cc8
parent 1 9b2a99adc05e53cd4010de512f50118594756650
child 37150 9206cc10a0d18a37134eaa09b4351b281475d581
permissions -rw-r--r--
Bug 372970. Implement navigator.offlineResources. patch by Dave Camp, r+sr=jst

#!/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";
} 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);