1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/docshell/test/chrome/gen_template.pl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,37 @@ 1.4 +#!/usr/bin/perl 1.5 +# 1.6 +# gen_template.pl 1.7 +# Makes docshell test case templates. 1.8 +# Takes one argument: 1.9 +# 1.10 +# -b : a bugnumber 1.11 +# 1.12 +# e.g.: perl gen_template.pl -b 303267 1.13 +# 1.14 +# Writes test case template files for bug 303267 to the current directory. 1.15 +use FindBin; 1.16 +use Getopt::Long; 1.17 +GetOptions("b=i"=> \$bug_number); 1.18 + 1.19 +$template = "$FindBin::RealBin/test.template.txt"; 1.20 + 1.21 +open(IN,$template) or die("Failed to open input file for reading."); 1.22 +open(OUT, ">>test_bug" . $bug_number . ".xul") or die("Failed to open output file for appending."); 1.23 +while((defined(IN)) && ($line = <IN>)) { 1.24 + $line =~ s/{BUGNUMBER}/$bug_number/g; 1.25 + print OUT $line; 1.26 +} 1.27 +close(IN); 1.28 +close(OUT); 1.29 + 1.30 +$template = "$FindBin::RealBin/window.template.txt"; 1.31 + 1.32 +open(IN,$template) or die("Failed to open input file for reading."); 1.33 +open(OUT, ">>bug" . $bug_number . "_window.xul") or die("Failed to open output file for appending."); 1.34 +while((defined(IN)) && ($line = <IN>)) { 1.35 + $line =~ s/{BUGNUMBER}/$bug_number/g; 1.36 + print OUT $line; 1.37 +} 1.38 +close(IN); 1.39 +close(OUT); 1.40 +