testing/mochitest/gen_template.pl
author Till Schneidereit <tschneidereit@gmail.com>
Tue, 18 Sep 2012 22:11:37 +0200
changeset 113096 862f9cd7eb0bebf5fcc4e7a6a550bfbe0b1740db
parent 37150 9206cc10a0d18a37134eaa09b4351b281475d581
child 114729 f4fe16db035ad4f39a1d01222d2f9919dabf1761
permissions -rw-r--r--
Bug 791850 - Lazily clone self-hosted methods installed via js_DefineFunction. r=luke

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