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