testing/mochitest/gen_template.pl

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

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

mercurial