2006-10-26 00:40:15 +04:00
|
|
|
#!/usr/bin/perl
|
|
|
|
#
|
|
|
|
# gen_template.pl
|
|
|
|
# Makes test case templates.
|
2006-11-07 03:56:50 +03:00
|
|
|
# Takes two arguments:
|
2006-10-26 00:40:15 +04:00
|
|
|
#
|
2006-11-07 03:56:50 +03:00
|
|
|
# -b : a bugnumber
|
|
|
|
# -type : template type. {html|xhtml|xul}. defaults to html.
|
|
|
|
#
|
|
|
|
# perl gen_template.pl -b 345876 -type xul
|
2006-10-26 00:40:15 +04:00
|
|
|
#
|
|
|
|
# sends a test case template for bug 345876 to stdout
|
2006-11-08 22:19:19 +03:00
|
|
|
use FindBin;
|
2006-11-07 03:56:50 +03:00
|
|
|
use Getopt::Long;
|
|
|
|
GetOptions("b=i"=> \$bug_number,
|
|
|
|
"type:s"=> \$template_type);
|
2006-10-26 00:40:15 +04:00
|
|
|
|
2006-11-08 10:07:44 +03:00
|
|
|
if ($template_type eq "xul") {
|
2006-11-08 22:19:19 +03:00
|
|
|
$template_type = "$FindBin::RealBin/static/xul.template.txt";
|
2006-11-08 10:07:44 +03:00
|
|
|
} elsif ($template_type eq "xhtml") {
|
2006-11-08 22:19:19 +03:00
|
|
|
$template_type = "$FindBin::RealBin/static/xhtml.template.txt";
|
2006-11-07 03:56:50 +03:00
|
|
|
} else {
|
2006-11-08 22:19:19 +03:00
|
|
|
$template_type = "$FindBin::RealBin/static/test.template.txt";
|
2006-11-07 03:56:50 +03:00
|
|
|
}
|
2006-10-26 00:40:15 +04:00
|
|
|
|
2006-11-07 03:56:50 +03:00
|
|
|
open(IN,$template_type) or die("Failed to open myfile for reading.");
|
2006-10-26 00:40:15 +04:00
|
|
|
while((defined(IN)) && ($line = <IN>)) {
|
|
|
|
$line =~ s/{BUGNUMBER}/$bug_number/g;
|
|
|
|
print STDOUT $line;
|
|
|
|
}
|
|
|
|
close(IN);
|