summaryrefslogtreecommitdiffstats
path: root/modules/libpref/test/unit/data
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/libpref/test/unit/data/testParser.js98
-rw-r--r--modules/libpref/test/unit/data/testPref.js6
-rw-r--r--modules/libpref/test/unit/data/testPrefLocked.js2
-rw-r--r--modules/libpref/test/unit/data/testPrefLockedUser.js3
-rw-r--r--modules/libpref/test/unit/data/testPrefSticky.js2
-rw-r--r--modules/libpref/test/unit/data/testPrefStickyUser.js5
-rw-r--r--modules/libpref/test/unit/data/testPrefUTF8.js6
7 files changed, 122 insertions, 0 deletions
diff --git a/modules/libpref/test/unit/data/testParser.js b/modules/libpref/test/unit/data/testParser.js
new file mode 100644
index 0000000000..be29430b2a
--- /dev/null
+++ b/modules/libpref/test/unit/data/testParser.js
@@ -0,0 +1,98 @@
+// Note: this file tests only valid syntax (of default pref files, not user
+// pref files). See modules/libpref/test/gtest/Parser.cpp for tests of invalid
+// syntax.
+
+#
+# comment
+ # comment £
+//
+// comment
+ // comment £
+/**/
+ /* comment £ */
+/* comment
+ * and
+some
+ # more
+ // comment */
+// comment /*
+# comment /*
+/* /* /* /* /* ...no nesting of C-style comments... */
+
+// The following four lines have whitespace: \t, \v, \f, \r
+
+
+
+
+
+// This comment has the same whitespace:
+# This comment has other stuff: \n \r \t \v \f \r \a \b \? \' \" \\ \@
+/* This comment has more stuff: \x61 \u0061 \u1234 \uXYZ */
+
+/*0*/ pref /*1*/ ( /*2*/ "comment1" /*3*/ , /*4*/ true /*5*/ ) /*6*/ ; /*7*/
+
+pref # foo
+( // foo
+"comment2" /*
+foo
+*/,/*foo*/
+true#foo
+)//
+; /*7*/
+
+pref
+ (
+ "spaced-out"
+ ,
+ true
+ )
+ ;
+
+pref("pref", true);
+sticky_pref("sticky_pref", true);
+user_pref("user_pref", true);
+pref("sticky_pref2", true, sticky);
+pref("locked_pref", true, locked);
+pref("locked_sticky_pref", true, locked, sticky,sticky,
+ locked, locked, locked);
+
+pref("bool.true", true);
+pref("bool.false", false);
+
+pref("int.0", 0);
+pref("int.1", 1);
+pref("int.123", 123);
+pref("int.+234", +234);
+pref("int.+ 345", + 345);
+// Note that both the prefname and value have tabs in them
+pref("int.-0", -0);
+pref("int.-1", -1);
+pref("int.- /* hmm */ 456", - /* hmm */ 456);
+pref("int.-\n567", -
+567);
+pref("int.INT_MAX-1", 2147483646);
+pref("int.INT_MAX", 2147483647);
+pref("int.INT_MIN+2", -2147483646);
+pref("int.INT_MIN+1", -2147483647);
+pref("int.INT_MIN", -2147483648);
+//pref("int.overflow.max", 2147483648); // overflows to -2147483648
+//pref("int.overflow.min", -2147483649); // overflows to 2147483647
+//pref("int.overflow.other", 4000000000); // overflows to -294967296
+//pref("int.overflow.another", 5000000000000000); // overflows to 937459712
+
+pref("string.empty", "");
+pref("string.abc", "abc");
+pref("string.long", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
+pref('string.single-quotes', '"abc"');
+pref("string.double-quotes", "'abc'");
+pref("string.weird-chars", "  ");
+pref("string.escapes", "\" \' \\ \n \r");
+pref("string.x-escapes1", "Mozilla0\x4d\x6F\x7a\x69\x6c\x6C\x610");
+pref("string.x-escapes2", "A\x41 A_umlaut\xc4 y_umlaut\xff");
+pref("string.u-escapes1", "A\u0041 A_umlaut\u00c4 y_umlaut\u00ff0");
+pref("string.u-escapes2", "S_acute\u015a y_grave\u1Ef3");
+// CYCLONE is 0x1f300, GRINNING FACE is 0x1f600. We have to represent them via
+// surrogate pairs.
+pref("string.u-surrogates",
+ "cyclone\uD83C\uDF00 grinning_face\uD83D\uDE00");
+
diff --git a/modules/libpref/test/unit/data/testPref.js b/modules/libpref/test/unit/data/testPref.js
new file mode 100644
index 0000000000..0864e7ce8b
--- /dev/null
+++ b/modules/libpref/test/unit/data/testPref.js
@@ -0,0 +1,6 @@
+user_pref("testPref.bool1", true);
+user_pref("testPref.bool2", false);
+user_pref("testPref.int1", 23);
+user_pref("testPref.int2", -1236);
+user_pref("testPref.char1", "_testPref");
+user_pref("testPref.char2", "älskar"); \ No newline at end of file
diff --git a/modules/libpref/test/unit/data/testPrefLocked.js b/modules/libpref/test/unit/data/testPrefLocked.js
new file mode 100644
index 0000000000..001b65122b
--- /dev/null
+++ b/modules/libpref/test/unit/data/testPrefLocked.js
@@ -0,0 +1,2 @@
+pref("testPref.unlocked.int", 333);
+pref("testPref.locked.int", 444, locked);
diff --git a/modules/libpref/test/unit/data/testPrefLockedUser.js b/modules/libpref/test/unit/data/testPrefLockedUser.js
new file mode 100644
index 0000000000..4da40b7abc
--- /dev/null
+++ b/modules/libpref/test/unit/data/testPrefLockedUser.js
@@ -0,0 +1,3 @@
+// testPrefLocked.js defined this pref as a locked pref.
+// Changing a locked pref has no effect.
+user_pref("testPref.locked.int", 555);
diff --git a/modules/libpref/test/unit/data/testPrefSticky.js b/modules/libpref/test/unit/data/testPrefSticky.js
new file mode 100644
index 0000000000..ef1a02adfd
--- /dev/null
+++ b/modules/libpref/test/unit/data/testPrefSticky.js
@@ -0,0 +1,2 @@
+pref("testPref.unsticky.bool", true);
+pref("testPref.sticky.bool", false, sticky);
diff --git a/modules/libpref/test/unit/data/testPrefStickyUser.js b/modules/libpref/test/unit/data/testPrefStickyUser.js
new file mode 100644
index 0000000000..d929c670ad
--- /dev/null
+++ b/modules/libpref/test/unit/data/testPrefStickyUser.js
@@ -0,0 +1,5 @@
+// testPrefSticky.js defined this pref as sticky. Once a sticky
+// pref has been changed, it's written as a user_pref().
+// So this test file reflects that scenario.
+// Note the default in testPrefSticky.js is also false.
+user_pref("testPref.sticky.bool", false);
diff --git a/modules/libpref/test/unit/data/testPrefUTF8.js b/modules/libpref/test/unit/data/testPrefUTF8.js
new file mode 100644
index 0000000000..a409c4eb72
--- /dev/null
+++ b/modules/libpref/test/unit/data/testPrefUTF8.js
@@ -0,0 +1,6 @@
+user_pref("testPref.bool1", true);
+user_pref("testPref.bool2", false);
+user_pref("testPref.int1", 23);
+user_pref("testPref.int2", -1236);
+user_pref("testPref.char1", "_testPref");
+user_pref("testPref.char2", "älskar");