tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

gen_template.pl (1085B)


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