Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
michael@0 | 1 | #!/usr/bin/perl |
michael@0 | 2 | # |
michael@0 | 3 | # gen_template.pl |
michael@0 | 4 | # Makes test case templates. |
michael@0 | 5 | # Takes two arguments: |
michael@0 | 6 | # |
michael@0 | 7 | # -b : a bugnumber |
michael@0 | 8 | # -type : template type. {html|xhtml|xul|th}. defaults to html. |
michael@0 | 9 | # |
michael@0 | 10 | # perl gen_template.pl -b 345876 -type xul |
michael@0 | 11 | # |
michael@0 | 12 | # sends a test case template for bug 345876 to stdout |
michael@0 | 13 | use FindBin; |
michael@0 | 14 | use Getopt::Long; |
michael@0 | 15 | GetOptions("b=i"=> \$bug_number, |
michael@0 | 16 | "type:s"=> \$template_type); |
michael@0 | 17 | |
michael@0 | 18 | if ($template_type eq "xul") { |
michael@0 | 19 | $template_type = "$FindBin::RealBin/static/xul.template.txt"; |
michael@0 | 20 | } elsif ($template_type eq "xhtml") { |
michael@0 | 21 | $template_type = "$FindBin::RealBin/static/xhtml.template.txt"; |
michael@0 | 22 | } elsif ($template_type eq "chrome") { |
michael@0 | 23 | $template_type = "$FindBin::RealBin/static/chrome.template.txt"; |
michael@0 | 24 | } elsif ($template_type eq "th") { |
michael@0 | 25 | $template_type = "$FindBin::RealBin/static/th.template.txt"; |
michael@0 | 26 | } else { |
michael@0 | 27 | $template_type = "$FindBin::RealBin/static/test.template.txt"; |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | open(IN,$template_type) or die("Failed to open myfile for reading."); |
michael@0 | 31 | while((defined(IN)) && ($line = <IN>)) { |
michael@0 | 32 | $line =~ s/{BUGNUMBER}/$bug_number/g; |
michael@0 | 33 | print STDOUT $line; |
michael@0 | 34 | } |
michael@0 | 35 | close(IN); |