summaryrefslogtreecommitdiffstats
path: root/testing/mochitest/gen_template.pl
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/mochitest/gen_template.pl
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/mochitest/gen_template.pl')
-rw-r--r--testing/mochitest/gen_template.pl42
1 files changed, 42 insertions, 0 deletions
diff --git a/testing/mochitest/gen_template.pl b/testing/mochitest/gen_template.pl
new file mode 100644
index 000000000..5212d5e82
--- /dev/null
+++ b/testing/mochitest/gen_template.pl
@@ -0,0 +1,42 @@
+#!/usr/bin/perl
+
+# This script makes mochitest test case templates. See
+# https://developer.mozilla.org/en-US/docs/Mochitest#Test_templates
+#
+# It takes two arguments:
+#
+# -b: a bugnumber
+# -type: template type. One of {plain|xhtml|xul|th|chrome|chromexul}.
+# Defaults to th (testharness.js).
+#
+# For example, this command:
+#
+# perl gen_template.pl -b 345876 -type xul
+#
+# writes a XUL test case template for bug 345876 to stdout.
+
+use FindBin;
+use Getopt::Long;
+GetOptions("b=i"=> \$bug_number,
+ "type:s"=> \$template_type);
+
+if ($template_type eq "xul") {
+ $template_type = "$FindBin::RealBin/static/xul.template.txt";
+} elsif ($template_type eq "xhtml") {
+ $template_type = "$FindBin::RealBin/static/xhtml.template.txt";
+} elsif ($template_type eq "chrome") {
+ $template_type = "$FindBin::RealBin/static/chrome.template.txt";
+} elsif ($template_type eq "chromexul") {
+ $template_type = "$FindBin::RealBin/static/chromexul.template.txt";
+} elsif ($template_type eq "plain") {
+ $template_type = "$FindBin::RealBin/static/test.template.txt";
+} else {
+ $template_type = "$FindBin::RealBin/static/th.template.txt";
+}
+
+open(IN,$template_type) or die("Failed to open myfile for reading.");
+while((defined(IN)) && ($line = <IN>)) {
+ $line =~ s/{BUGNUMBER}/$bug_number/g;
+ print STDOUT $line;
+}
+close(IN);