docshell/test/chrome/gen_template.pl
author Ryan VanderMeulen <ryanvm@gmail.com>
Thu, 04 Apr 2013 10:42:28 -0400
changeset 127662 6b8868104188d18eaff56400e29e2f4f79ea12de
parent 29928 f1e7a0072ccfaebc9ae439d2d7590319a1a7ce64
child 212996 134b583fd7abf41496478aa08f63ac8f47ee09ff
permissions -rw-r--r--
Backed out changeset 061b9318815b (bug 846906) for accidentally removing mach.

#!/usr/bin/perl
#
#  gen_template.pl
#  Makes docshell test case templates.
#  Takes one argument:
#
#  -b : a bugnumber
#
#  e.g.: perl gen_template.pl -b 303267
#
#  Writes test case template files for bug 303267 to the current directory.
use FindBin;
use Getopt::Long;
GetOptions("b=i"=> \$bug_number);

$template = "$FindBin::RealBin/test.template.txt";

open(IN,$template) or die("Failed to open input file for reading.");
open(OUT, ">>test_bug" . $bug_number . ".xul") or die("Failed to open output file for appending.");
while((defined(IN)) && ($line = <IN>)) {
        $line =~ s/{BUGNUMBER}/$bug_number/g;
        print OUT $line;
}
close(IN);
close(OUT);

$template = "$FindBin::RealBin/window.template.txt";

open(IN,$template) or die("Failed to open input file for reading.");
open(OUT, ">>bug" . $bug_number . "_window.xul") or die("Failed to open output file for appending.");
while((defined(IN)) && ($line = <IN>)) {
        $line =~ s/{BUGNUMBER}/$bug_number/g;
        print OUT $line;
}
close(IN);
close(OUT);