Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | #!/usr/bin/perl |
michael@0 | 2 | # |
michael@0 | 3 | # gen_template.pl |
michael@0 | 4 | # Makes docshell test case templates. |
michael@0 | 5 | # Takes one argument: |
michael@0 | 6 | # |
michael@0 | 7 | # -b : a bugnumber |
michael@0 | 8 | # |
michael@0 | 9 | # e.g.: perl gen_template.pl -b 303267 |
michael@0 | 10 | # |
michael@0 | 11 | # Writes test case template files for bug 303267 to the current directory. |
michael@0 | 12 | use FindBin; |
michael@0 | 13 | use Getopt::Long; |
michael@0 | 14 | GetOptions("b=i"=> \$bug_number); |
michael@0 | 15 | |
michael@0 | 16 | $template = "$FindBin::RealBin/test.template.txt"; |
michael@0 | 17 | |
michael@0 | 18 | open(IN,$template) or die("Failed to open input file for reading."); |
michael@0 | 19 | open(OUT, ">>test_bug" . $bug_number . ".xul") or die("Failed to open output file for appending."); |
michael@0 | 20 | while((defined(IN)) && ($line = <IN>)) { |
michael@0 | 21 | $line =~ s/{BUGNUMBER}/$bug_number/g; |
michael@0 | 22 | print OUT $line; |
michael@0 | 23 | } |
michael@0 | 24 | close(IN); |
michael@0 | 25 | close(OUT); |
michael@0 | 26 | |
michael@0 | 27 | $template = "$FindBin::RealBin/window.template.txt"; |
michael@0 | 28 | |
michael@0 | 29 | open(IN,$template) or die("Failed to open input file for reading."); |
michael@0 | 30 | open(OUT, ">>bug" . $bug_number . "_window.xul") or die("Failed to open output file for appending."); |
michael@0 | 31 | while((defined(IN)) && ($line = <IN>)) { |
michael@0 | 32 | $line =~ s/{BUGNUMBER}/$bug_number/g; |
michael@0 | 33 | print OUT $line; |
michael@0 | 34 | } |
michael@0 | 35 | close(IN); |
michael@0 | 36 | close(OUT); |
michael@0 | 37 |