1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/testing/mochitest/gen_template.pl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,35 @@ 1.4 +#!/usr/bin/perl 1.5 +# 1.6 +# gen_template.pl 1.7 +# Makes test case templates. 1.8 +# Takes two arguments: 1.9 +# 1.10 +# -b : a bugnumber 1.11 +# -type : template type. {html|xhtml|xul|th}. defaults to html. 1.12 +# 1.13 +# perl gen_template.pl -b 345876 -type xul 1.14 +# 1.15 +# sends a test case template for bug 345876 to stdout 1.16 +use FindBin; 1.17 +use Getopt::Long; 1.18 +GetOptions("b=i"=> \$bug_number, 1.19 + "type:s"=> \$template_type); 1.20 + 1.21 +if ($template_type eq "xul") { 1.22 + $template_type = "$FindBin::RealBin/static/xul.template.txt"; 1.23 +} elsif ($template_type eq "xhtml") { 1.24 + $template_type = "$FindBin::RealBin/static/xhtml.template.txt"; 1.25 +} elsif ($template_type eq "chrome") { 1.26 + $template_type = "$FindBin::RealBin/static/chrome.template.txt"; 1.27 +} elsif ($template_type eq "th") { 1.28 + $template_type = "$FindBin::RealBin/static/th.template.txt"; 1.29 +} else { 1.30 + $template_type = "$FindBin::RealBin/static/test.template.txt"; 1.31 +} 1.32 + 1.33 +open(IN,$template_type) or die("Failed to open myfile for reading."); 1.34 +while((defined(IN)) && ($line = <IN>)) { 1.35 + $line =~ s/{BUGNUMBER}/$bug_number/g; 1.36 + print STDOUT $line; 1.37 +} 1.38 +close(IN);