testParser.js (3117B)
1 // Note: this file tests only valid syntax (of default pref files, not user 2 // pref files). See modules/libpref/test/gtest/Parser.cpp for tests of invalid 3 // syntax. 4 5 # 6 # comment 7 # comment £ 8 // 9 // comment 10 // comment £ 11 /**/ 12 /* comment £ */ 13 /* comment 14 * and 15 some 16 # more 17 // comment */ 18 // comment /* 19 # comment /* 20 /* /* /* /* /* ...no nesting of C-style comments... */ 21 22 // The following four lines have whitespace: \t, \v, \f, \r 23 24 25 26 27 28 // This comment has the same whitespace: 29 # This comment has other stuff: \n \r \t \v \f \r \a \b \? \' \" \\ \@ 30 /* This comment has more stuff: \x61 \u0061 \u1234 \uXYZ */ 31 32 /*0*/ pref /*1*/ ( /*2*/ "comment1" /*3*/ , /*4*/ true /*5*/ ) /*6*/ ; /*7*/ 33 34 pref # foo 35 ( // foo 36 "comment2" /* 37 foo 38 */,/*foo*/ 39 true#foo 40 )// 41 ; /*7*/ 42 43 pref 44 ( 45 "spaced-out" 46 , 47 true 48 ) 49 ; 50 51 pref("pref", true); 52 sticky_pref("sticky_pref", true); 53 user_pref("user_pref", true); 54 pref("sticky_pref2", true, sticky); 55 pref("locked_pref", true, locked); 56 pref("locked_sticky_pref", true, locked, sticky,sticky, 57 locked, locked, locked); 58 59 pref("bool.true", true); 60 pref("bool.false", false); 61 62 pref("int.0", 0); 63 pref("int.1", 1); 64 pref("int.123", 123); 65 pref("int.+234", +234); 66 pref("int.+ 345", + 345); 67 // Note that both the prefname and value have tabs in them 68 pref("int.-0", -0); 69 pref("int.-1", -1); 70 pref("int.- /* hmm */ 456", - /* hmm */ 456); 71 pref("int.-\n567", - 72 567); 73 pref("int.INT_MAX-1", 2147483646); 74 pref("int.INT_MAX", 2147483647); 75 pref("int.INT_MIN+2", -2147483646); 76 pref("int.INT_MIN+1", -2147483647); 77 pref("int.INT_MIN", -2147483648); 78 //pref("int.overflow.max", 2147483648); // overflows to -2147483648 79 //pref("int.overflow.min", -2147483649); // overflows to 2147483647 80 //pref("int.overflow.other", 4000000000); // overflows to -294967296 81 //pref("int.overflow.another", 5000000000000000); // overflows to 937459712 82 83 pref("string.empty", ""); 84 pref("string.abc", "abc"); 85 pref("string.long", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); 86 pref('string.single-quotes', '"abc"'); 87 pref("string.double-quotes", "'abc'"); 88 pref("string.weird-chars", " "); 89 pref("string.escapes", "\" \' \\ \n \r"); 90 pref("string.x-escapes1", "Mozilla0\x4d\x6F\x7a\x69\x6c\x6C\x610"); 91 pref("string.x-escapes2", "A\x41 A_umlaut\xc4 y_umlaut\xff"); 92 pref("string.u-escapes1", "A\u0041 A_umlaut\u00c4 y_umlaut\u00ff0"); 93 pref("string.u-escapes2", "S_acute\u015a y_grave\u1Ef3"); 94 // CYCLONE is 0x1f300, GRINNING FACE is 0x1f600. We have to represent them via 95 // surrogate pairs. 96 pref("string.u-surrogates", 97 "cyclone\uD83C\uDF00 grinning_face\uD83D\uDE00");