diff --git a/intl/uconv/tests/unit/CharsetConversionTests.js b/intl/uconv/tests/unit/CharsetConversionTests.js new file mode 100644 index 000000000000..8d7bd8ae31ce --- /dev/null +++ b/intl/uconv/tests/unit/CharsetConversionTests.js @@ -0,0 +1,50 @@ +const Ci = Components.interfaces; +const Cc = Components.classes; +const CC = Components.Constructor; + +function CreateScriptableConverter() +{ + var ScriptableUnicodeConverter = + CC("@mozilla.org/intl/scriptableunicodeconverter", + "nsIScriptableUnicodeConverter"); + + return new ScriptableUnicodeConverter(); +} + +function checkDecode(converter, charset, inText, expectedText) +{ + converter.charset = charset; + + dump("testing decoding from " + charset + " to Unicode.\n"); + try { + var outText = converter.ConvertToUnicode(inText) + converter.Finish(); + } catch(e) { + outText = "\ufffd"; + } + do_check_eq(outText, expectedText); +} + +function checkEncode(converter, charset, inText, expectedText) +{ + converter.charset = charset; + + dump("testing encoding from Unicode to " + charset + "\n"); + var outText = converter.ConvertFromUnicode(inText) + converter.Finish(); + do_check_eq(outText, expectedText); +} + +function testDecodeAliases() +{ + var converter = CreateScriptableConverter(); + for (var i = 0; i < aliases.length; ++i) { + checkDecode(converter, aliases[i], inString, expectedString); + } +} + +function testEncodeAliases() +{ + var converter = CreateScriptableConverter(); + for (var i = 0; i < aliases.length; ++i) { + checkEncode(converter, aliases[i], inString, expectedString); + } +} diff --git a/intl/uconv/tests/unit/test_bug116882.js b/intl/uconv/tests/unit/test_bug116882.js index 95097eaa839e..9816f775243c 100644 --- a/intl/uconv/tests/unit/test_bug116882.js +++ b/intl/uconv/tests/unit/test_bug116882.js @@ -6,14 +6,8 @@ const inText = "\xfd\xfe\xff\x81\x20\x81\x3f\x86\x3c"; const expectedText = "\uf8f1\uf8f2\uf8f3\u30fb\u30fb\u30fb"; const charset = "Shift_JIS"; +load('CharsetConversionTests.js'); + function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outText = converter.ConvertToUnicode(inText) + converter.Finish(); - do_check_eq(outText, expectedText); + checkDecode(CreateScriptableConverter(), charset, inText, expectedText); } diff --git a/intl/uconv/tests/unit/test_bug367026.js b/intl/uconv/tests/unit/test_bug367026.js index d892ecfcdc0c..3e89fbf4ffa0 100644 --- a/intl/uconv/tests/unit/test_bug367026.js +++ b/intl/uconv/tests/unit/test_bug367026.js @@ -8,6 +8,8 @@ * See http://www.ietf.org/rfc/rfc1843.txt */ +load('CharsetConversionTests.js'); + const inASCII = "Hello World"; const inHanzi = "\u4E00"; const inMixed = "Hello \u4E00 World"; @@ -19,19 +21,9 @@ const expectedMixed = "Hello ~{R;~} World"; const charset = "HZ-GB-2312"; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); + var converter = CreateScriptableConverter(); - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outASCII = converter.ConvertFromUnicode(inASCII) + converter.Finish(); - do_check_eq(outASCII, expectedASCII); - - var outMixed = converter.ConvertFromUnicode(inMixed) + converter.Finish(); - do_check_eq(outMixed, expectedMixed); - - var outHanzi = converter.ConvertFromUnicode(inHanzi) + converter.Finish(); - do_check_eq(outHanzi, expectedHanzi); + checkEncode(converter, charset, inASCII, expectedASCII); + checkEncode(converter, charset, inMixed, expectedMixed); + checkEncode(converter, charset, inHanzi, expectedHanzi); } diff --git a/intl/uconv/tests/unit/test_bug396637.js b/intl/uconv/tests/unit/test_bug396637.js index 954c29f4d9da..70cd66804d2a 100644 --- a/intl/uconv/tests/unit/test_bug396637.js +++ b/intl/uconv/tests/unit/test_bug396637.js @@ -1,22 +1,11 @@ // Tests conversion of a single byte from UTF-16 to Unicode + +load('CharsetConversionTests.js'); const inString = "A"; - const expectedString = "\ufffd"; - const charset = "UTF-16BE"; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - try { - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - } catch(e) { - outString = "\ufffd"; - } - do_check_eq(outString, expectedString); + checkDecode(CreateScriptableConverter(), charset, inString, expectedString); } diff --git a/intl/uconv/tests/unit/test_bug399257.js b/intl/uconv/tests/unit/test_bug399257.js index 16102ea16130..03a6361e1e2b 100644 --- a/intl/uconv/tests/unit/test_bug399257.js +++ b/intl/uconv/tests/unit/test_bug399257.js @@ -1,16 +1,14 @@ // Tests encoding of characters below U+0020 -const Ci = Components.interfaces; -const Cc = Components.classes; +load('CharsetConversionTests.js'); + const inString = "Hello\u000aWorld"; const expectedString = "Hello\nWorld"; - function run_test() { var failures = false; var ccManager = Cc["@mozilla.org/charset-converter-manager;1"] .getService(Ci.nsICharsetConverterManager); - var encodingConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"] - .createInstance(Ci.nsIScriptableUnicodeConverter); + var encodingConverter = CreateScriptableConverter(); var charsetList = ccManager.getDecoderList(); var counter = 0; diff --git a/intl/uconv/tests/unit/test_bug457886.js b/intl/uconv/tests/unit/test_bug457886.js index 5c5a547015aa..0d617d22bcef 100644 --- a/intl/uconv/tests/unit/test_bug457886.js +++ b/intl/uconv/tests/unit/test_bug457886.js @@ -1,20 +1,14 @@ -// Tests conversion from Unicode to ISO-2022-JP - -const inString = "\u3042\u3044\u3046\u3048\u304A\u000D\u000A\u304B\u304D\u304F\u3051\u3053"; - -const expectedString = "\x1B$B$\"$$$&$($*\x1B(B\x0D\x0A\x1B$B$+$-$/$1$3\x1B(B"; - -const charset = "ISO-2022-JP"; - -function run_test() -{ - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); -} +// Tests conversion from Unicode to ISO-2022-JP + +load('CharsetConversionTests.js'); + +const inString = "\u3042\u3044\u3046\u3048\u304A\u000D\u000A\u304B\u304D\u304F\u3051\u3053"; + +const expectedString = "\x1B$B$\"$$$&$($*\x1B(B\x0D\x0A\x1B$B$+$-$/$1$3\x1B(B"; + +const charset = "ISO-2022-JP"; + +function run_test() +{ + checkEncode(CreateScriptableConverter(), charset, inString, expectedString); +} diff --git a/intl/uconv/tests/unit/test_decode_8859-1.js b/intl/uconv/tests/unit/test_decode_8859-1.js index 9d16e8663d4d..54426b9ed93c 100644 --- a/intl/uconv/tests/unit/test_decode_8859-1.js +++ b/intl/uconv/tests/unit/test_decode_8859-1.js @@ -1,19 +1,15 @@ // Tests conversion from ISO-8859-1 to Unicode + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf\u00d0\u00d1\u00d2\u00d3\u00d4\u00d5\u00d6\u00d7\u00d8\u00d9\u00da\u00db\u00dc\u00dd\u00de\u00df\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed\u00ee\u00ef\u00f0\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u00f7\u00f8\u00f9\u00fa\u00fb\u00fc\u00fd\u00fe\u00ff"; -const charset = "ISO-8859-1"; +const aliases = [ "ISO-8859-1", "iso-8859-1", "latin1", "iso_8859-1", + "iso8859-1", "iso-ir-100", "l1", "ibm819", "cp819", + "csisolatin1", "iso88591" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_8859-10.js b/intl/uconv/tests/unit/test_decode_8859-10.js index ea108d07cc85..163046fc6525 100644 --- a/intl/uconv/tests/unit/test_decode_8859-10.js +++ b/intl/uconv/tests/unit/test_decode_8859-10.js @@ -1,19 +1,14 @@ // Tests conversion from ISO-8859-10 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u0104\u0112\u0122\u012a\u0128\u0136\u00a7\u013b\u0110\u0160\u0166\u017d\u00ad\u016a\u014a\u00b0\u0105\u0113\u0123\u012b\u0129\u0137\u00b7\u013c\u0111\u0161\u0167\u017e\u2015\u016b\u014b\u0100\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u012e\u010c\u00c9\u0118\u00cb\u0116\u00cd\u00ce\u00cf\u00d0\u0145\u014c\u00d3\u00d4\u00d5\u00d6\u0168\u00d8\u0172\u00da\u00db\u00dc\u00dd\u00de\u00df\u0101\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u012f\u010d\u00e9\u0119\u00eb\u0117\u00ed\u00ee\u00ef\u00f0\u0146\u014d\u00f3\u00f4\u00f5\u00f6\u0169\u00f8\u0173\u00fa\u00fb\u00fc\u00fd\u00fe\u0138"; -const charset = "ISO-8859-10"; +const aliases = [ "ISO-8859-10", "iso-8859-10", "iso8859-10", "latin6", + "iso-ir-157", "l6", "csisolatin6", "iso885910" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_8859-11.js b/intl/uconv/tests/unit/test_decode_8859-11.js index 99cb1bd430e2..92a8dd0f31e8 100644 --- a/intl/uconv/tests/unit/test_decode_8859-11.js +++ b/intl/uconv/tests/unit/test_decode_8859-11.js @@ -1,19 +1,13 @@ // Tests conversion from ISO-8859-11 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u0e01\u0e02\u0e03\u0e04\u0e05\u0e06\u0e07\u0e08\u0e09\u0e0a\u0e0b\u0e0c\u0e0d\u0e0e\u0e0f\u0e10\u0e11\u0e12\u0e13\u0e14\u0e15\u0e16\u0e17\u0e18\u0e19\u0e1a\u0e1b\u0e1c\u0e1d\u0e1e\u0e1f\u0e20\u0e21\u0e22\u0e23\u0e24\u0e25\u0e26\u0e27\u0e28\u0e29\u0e2a\u0e2b\u0e2c\u0e2d\u0e2e\u0e2f\u0e30\u0e31\u0e32\u0e33\u0e34\u0e35\u0e36\u0e37\u0e38\u0e39\u0e3a\u0e3f\u0e40\u0e41\u0e42\u0e43\u0e44\u0e45\u0e46\u0e47\u0e48\u0e49\u0e4a\u0e4b\u0e4c\u0e4d\u0e4e\u0e4f\u0e50\u0e51\u0e52\u0e53\u0e54\u0e55\u0e56\u0e57\u0e58\u0e59\u0e5a\u0e5b"; -const charset = "ISO-8859-11"; +const aliases = [ "ISO-8859-11", "iso-8859-11", "iso8859-11", "iso885911" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_8859-13.js b/intl/uconv/tests/unit/test_decode_8859-13.js index 049a83179320..2b2b7b0d0fb6 100644 --- a/intl/uconv/tests/unit/test_decode_8859-13.js +++ b/intl/uconv/tests/unit/test_decode_8859-13.js @@ -1,19 +1,13 @@ // Tests conversion from ISO-8859-13 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u201d\u00a2\u00a3\u00a4\u201e\u00a6\u00a7\u00d8\u00a9\u0156\u00ab\u00ac\u00ad\u00ae\u00c6\u00b0\u00b1\u00b2\u00b3\u201c\u00b5\u00b6\u00b7\u00f8\u00b9\u0157\u00bb\u00bc\u00bd\u00be\u00e6\u0104\u012e\u0100\u0106\u00c4\u00c5\u0118\u0112\u010c\u00c9\u0179\u0116\u0122\u0136\u012a\u013b\u0160\u0143\u0145\u00d3\u014c\u00d5\u00d6\u00d7\u0172\u0141\u015a\u016a\u00dc\u017b\u017d\u00df\u0105\u012f\u0101\u0107\u00e4\u00e5\u0119\u0113\u010d\u00e9\u017a\u0117\u0123\u0137\u012b\u013c\u0161\u0144\u0146\u00f3\u014d\u00f5\u00f6\u00f7\u0173\u0142\u015b\u016b\u00fc\u017c\u017e\u2019"; -const charset = "ISO-8859-13"; +const aliases = [ "ISO-8859-13", "iso-8859-13", "iso8859-13", "iso885913" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_8859-14.js b/intl/uconv/tests/unit/test_decode_8859-14.js index 5ab48adac5d0..3632e3a574da 100644 --- a/intl/uconv/tests/unit/test_decode_8859-14.js +++ b/intl/uconv/tests/unit/test_decode_8859-14.js @@ -1,19 +1,13 @@ // Tests conversion from ISO-8859-14 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u1e02\u1e03\u00a3\u010a\u010b\u1e0a\u00a7\u1e80\u00a9\u1e82\u1e0b\u1ef2\u00ad\u00ae\u0178\u1e1e\u1e1f\u0120\u0121\u1e40\u1e41\u00b6\u1e56\u1e81\u1e57\u1e83\u1e60\u1ef3\u1e84\u1e85\u1e61\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf\u0174\u00d1\u00d2\u00d3\u00d4\u00d5\u00d6\u1e6a\u00d8\u00d9\u00da\u00db\u00dc\u00dd\u0176\u00df\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed\u00ee\u00ef\u0175\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u1e6b\u00f8\u00f9\u00fa\u00fb\u00fc\u00fd\u0177\u00ff"; -const charset = "ISO-8859-14"; +const aliases = [ "ISO-8859-14", "iso-8859-14", "iso8859-14", "iso885914" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_8859-15.js b/intl/uconv/tests/unit/test_decode_8859-15.js index 7dcd4473a2c6..615be953c5a4 100644 --- a/intl/uconv/tests/unit/test_decode_8859-15.js +++ b/intl/uconv/tests/unit/test_decode_8859-15.js @@ -1,19 +1,14 @@ // Tests conversion from ISO-8859-15 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u00a1\u00a2\u00a3\u20ac\u00a5\u0160\u00a7\u0161\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u017d\u00b5\u00b6\u00b7\u017e\u00b9\u00ba\u00bb\u0152\u0153\u0178\u00bf\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf\u00d0\u00d1\u00d2\u00d3\u00d4\u00d5\u00d6\u00d7\u00d8\u00d9\u00da\u00db\u00dc\u00dd\u00de\u00df\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed\u00ee\u00ef\u00f0\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u00f7\u00f8\u00f9\u00fa\u00fb\u00fc\u00fd\u00fe\u00ff"; -const charset = "ISO-8859-15"; +const aliases = [ "ISO-8859-15", "iso-8859-15", "iso8859-15", "iso_8859-15", + "iso885915" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_8859-2.js b/intl/uconv/tests/unit/test_decode_8859-2.js index 45c3516f04bf..d7a02ba174e0 100644 --- a/intl/uconv/tests/unit/test_decode_8859-2.js +++ b/intl/uconv/tests/unit/test_decode_8859-2.js @@ -1,19 +1,14 @@ // Tests conversion from ISO-8859-2 to Unicode + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u0104\u02d8\u0141\u00a4\u013d\u015a\u00a7\u00a8\u0160\u015e\u0164\u0179\u00ad\u017d\u017b\u00b0\u0105\u02db\u0142\u00b4\u013e\u015b\u02c7\u00b8\u0161\u015f\u0165\u017a\u02dd\u017e\u017c\u0154\u00c1\u00c2\u0102\u00c4\u0139\u0106\u00c7\u010c\u00c9\u0118\u00cb\u011a\u00cd\u00ce\u010e\u0110\u0143\u0147\u00d3\u00d4\u0150\u00d6\u00d7\u0158\u016e\u00da\u0170\u00dc\u00dd\u0162\u00df\u0155\u00e1\u00e2\u0103\u00e4\u013a\u0107\u00e7\u010d\u00e9\u0119\u00eb\u011b\u00ed\u00ee\u010f\u0111\u0144\u0148\u00f3\u00f4\u0151\u00f6\u00f7\u0159\u016f\u00fa\u0171\u00fc\u00fd\u0163\u02d9"; -const charset = "ISO-8859-2"; +const aliases = [ "ISO-8859-2", "iso-8859-2", "latin2", "iso_8859-2", + "iso8859-2", "iso-ir-101", "l2", "csisolatin2", "iso88592" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_8859-3.js b/intl/uconv/tests/unit/test_decode_8859-3.js index cf59041f8fde..49b803a3dff4 100644 --- a/intl/uconv/tests/unit/test_decode_8859-3.js +++ b/intl/uconv/tests/unit/test_decode_8859-3.js @@ -1,19 +1,14 @@ // Tests conversion from ISO-8859-3 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u0126\u02d8\u00a3\u00a4\u0124\u00a7\u00a8\u0130\u015e\u011e\u0134\u00ad\u017b\u00b0\u0127\u00b2\u00b3\u00b4\u00b5\u0125\u00b7\u00b8\u0131\u015f\u011f\u0135\u00bd\u017c\u00c0\u00c1\u00c2\u00c4\u010a\u0108\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf\u00d1\u00d2\u00d3\u00d4\u0120\u00d6\u00d7\u011c\u00d9\u00da\u00db\u00dc\u016c\u015c\u00df\u00e0\u00e1\u00e2\u00e4\u010b\u0109\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed\u00ee\u00ef\u00f1\u00f2\u00f3\u00f4\u0121\u00f6\u00f7\u011d\u00f9\u00fa\u00fb\u00fc\u016d\u015d\u02d9"; -const charset = "ISO-8859-3"; +const aliases = [ "ISO-8859-3", "iso-8859-3", "latin3", "iso_8859-3", + "iso8859-3", "iso-ir-109", "l3", "csisolatin3", "iso88593" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_8859-4.js b/intl/uconv/tests/unit/test_decode_8859-4.js index 770b84fc69ba..c48cfaa8c027 100644 --- a/intl/uconv/tests/unit/test_decode_8859-4.js +++ b/intl/uconv/tests/unit/test_decode_8859-4.js @@ -1,19 +1,14 @@ // Tests conversion from ISO-8859-4 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u0104\u0138\u0156\u00a4\u0128\u013b\u00a7\u00a8\u0160\u0112\u0122\u0166\u00ad\u017d\u00af\u00b0\u0105\u02db\u0157\u00b4\u0129\u013c\u02c7\u00b8\u0161\u0113\u0123\u0167\u014a\u017e\u014b\u0100\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u012e\u010c\u00c9\u0118\u00cb\u0116\u00cd\u00ce\u012a\u0110\u0145\u014c\u0136\u00d4\u00d5\u00d6\u00d7\u00d8\u0172\u00da\u00db\u00dc\u0168\u016a\u00df\u0101\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u012f\u010d\u00e9\u0119\u00eb\u0117\u00ed\u00ee\u012b\u0111\u0146\u014d\u0137\u00f4\u00f5\u00f6\u00f7\u00f8\u0173\u00fa\u00fb\u00fc\u0169\u016b\u02d9"; -const charset = "ISO-8859-4"; +const aliases = [ "ISO-8859-4", "iso-8859-4", "latin4", "iso_8859-4", + "iso8859-4", "iso-ir-110", "l4", "csisolatin4", "iso88594" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_8859-5.js b/intl/uconv/tests/unit/test_decode_8859-5.js index 39458c7c28d5..093add54f5c5 100644 --- a/intl/uconv/tests/unit/test_decode_8859-5.js +++ b/intl/uconv/tests/unit/test_decode_8859-5.js @@ -1,19 +1,15 @@ // Tests conversion from ISO-8859-5 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u0401\u0402\u0403\u0404\u0405\u0406\u0407\u0408\u0409\u040a\u040b\u040c\u00ad\u040e\u040f\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u042f\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044b\u044c\u044d\u044e\u044f\u2116\u0451\u0452\u0453\u0454\u0455\u0456\u0457\u0458\u0459\u045a\u045b\u045c\u00a7\u045e\u045f"; -const charset = "ISO-8859-5"; +const aliases = [ "ISO-8859-5", "iso-8859-5", "iso_8859-5", "iso8859-5", + "iso-ir-144", "csisolatincyrillic", "iso88595" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } + diff --git a/intl/uconv/tests/unit/test_decode_8859-6.js b/intl/uconv/tests/unit/test_decode_8859-6.js index c18917dea107..1a2147bdb1bb 100644 --- a/intl/uconv/tests/unit/test_decode_8859-6.js +++ b/intl/uconv/tests/unit/test_decode_8859-6.js @@ -1,19 +1,15 @@ // Tests conversion from ISO-8859-6 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u00a4\u060c\u00ad\u061b\u061f\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062a\u062b\u062c\u062d\u062e\u062f\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063a\u0640\u0641\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064a\u064b\u064c\u064d\u064e\u064f\u0650\u0651\u0652"; -const charset = "ISO-8859-6"; +const aliases = [ "ISO-8859-6", "iso-8859-6", "iso_8859-6", "iso8859-6", + "arabic", "iso-ir-127", "ecma-114", "asmo-708", + "csisolatinarabic", "iso88596" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_8859-7.js b/intl/uconv/tests/unit/test_decode_8859-7.js index d8b939e2ac93..5d21ef83223c 100644 --- a/intl/uconv/tests/unit/test_decode_8859-7.js +++ b/intl/uconv/tests/unit/test_decode_8859-7.js @@ -1,19 +1,15 @@ // Tests conversion from ISO-8859-7 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u2018\u2019\u00a3\u20ac\u20af\u00a6\u00a7\u00a8\u00a9\u037a\u00ab\u00ac\u00ad\u2015\u00b0\u00b1\u00b2\u00b3\u0384\u0385\u0386\u00b7\u0388\u0389\u038a\u00bb\u038c\u00bd\u038e\u038f\u0390\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9\u03aa\u03ab\u03ac\u03ad\u03ae\u03af\u03b0\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9\u03ca\u03cb\u03cc\u03cd\u03ce"; -const charset = "ISO-8859-7"; +const aliases = [ "ISO-8859-7", "iso-8859-7", "greek", "greek8", "sun_eu_greek", + "iso_8859-7", "iso8859-7", "iso-ir-126", "elot_928", + "ecma-118", "csisolatingreek", "iso88597" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_8859-8.js b/intl/uconv/tests/unit/test_decode_8859-8.js index 276b24b508b8..59598cb10e68 100644 --- a/intl/uconv/tests/unit/test_decode_8859-8.js +++ b/intl/uconv/tests/unit/test_decode_8859-8.js @@ -1,19 +1,14 @@ // Tests conversion from ISO-8859-8 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00d7\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00f7\u00bb\u00bc\u00bd\u00be\u2017\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5\u05d6\u05d7\u05d8\u05d9\u05da\u05db\u05dc\u05dd\u05de\u05df\u05e0\u05e1\u05e2\u05e3\u05e4\u05e5\u05e6\u05e7\u05e8\u05e9\u05ea\u200e\u200f"; -const charset = "ISO-8859-8"; +const aliases = [ "ISO-8859-8", "iso-8859-8", "hebrew", "visual", "iso_8859-8", + "iso8859-8", "iso-ir-138", "csisolatinhebrew", "iso88598" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_8859-9.js b/intl/uconv/tests/unit/test_decode_8859-9.js index f702a948ae62..4cab7ea181e4 100644 --- a/intl/uconv/tests/unit/test_decode_8859-9.js +++ b/intl/uconv/tests/unit/test_decode_8859-9.js @@ -1,19 +1,14 @@ // Tests conversion from ISO-8859-9 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf\u011e\u00d1\u00d2\u00d3\u00d4\u00d5\u00d6\u00d7\u00d8\u00d9\u00da\u00db\u00dc\u0130\u015e\u00df\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed\u00ee\u00ef\u011f\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u00f7\u00f8\u00f9\u00fa\u00fb\u00fc\u0131\u015f\u00ff"; -const charset = "ISO-8859-9"; +const aliases = [ "ISO-8859-9", "iso-8859-9", "latin5", "iso_8859-9", + "iso8859-9", "iso-ir-148", "l5", "csisolatin5", "iso88599" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_CP1250.js b/intl/uconv/tests/unit/test_decode_CP1250.js index be792ab83aee..cff5d33acc15 100644 --- a/intl/uconv/tests/unit/test_decode_CP1250.js +++ b/intl/uconv/tests/unit/test_decode_CP1250.js @@ -1,19 +1,13 @@ // Tests conversion from windows-1250 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u201a\u201e\u2026\u2020\u2021\u2030\u0160\u2039\u015a\u0164\u017d\u0179\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u2122\u0161\u203a\u015b\u0165\u017e\u017a\u00a0\u02c7\u02d8\u0141\u00a4\u0104\u00a6\u00a7\u00a8\u00a9\u015e\u00ab\u00ac\u00ad\u00ae\u017b\u00b0\u00b1\u02db\u0142\u00b4\u00b5\u00b6\u00b7\u00b8\u0105\u015f\u00bb\u013d\u02dd\u013e\u017c\u0154\u00c1\u00c2\u0102\u00c4\u0139\u0106\u00c7\u010c\u00c9\u0118\u00cb\u011a\u00cd\u00ce\u010e\u0110\u0143\u0147\u00d3\u00d4\u0150\u00d6\u00d7\u0158\u016e\u00da\u0170\u00dc\u00dd\u0162\u00df\u0155\u00e1\u00e2\u0103\u00e4\u013a\u0107\u00e7\u010d\u00e9\u0119\u00eb\u011b\u00ed\u00ee\u010f\u0111\u0144\u0148\u00f3\u00f4\u0151\u00f6\u00f7\u0159\u016f\u00fa\u0171\u00fc\u00fd\u0163\u02d9"; -const charset = "windows-1250"; +const aliases = [ "windows-1250", "x-cp1250", "cp1250" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_CP1251.js b/intl/uconv/tests/unit/test_decode_CP1251.js index 8181ebd81e50..67448128dd42 100644 --- a/intl/uconv/tests/unit/test_decode_CP1251.js +++ b/intl/uconv/tests/unit/test_decode_CP1251.js @@ -1,19 +1,13 @@ // Tests conversion from windows-1251 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0402\u0403\u201a\u0453\u201e\u2026\u2020\u2021\u20ac\u2030\u0409\u2039\u040a\u040c\u040b\u040f\u0452\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u2122\u0459\u203a\u045a\u045c\u045b\u045f\u00a0\u040e\u045e\u0408\u00a4\u0490\u00a6\u00a7\u0401\u00a9\u0404\u00ab\u00ac\u00ad\u00ae\u0407\u00b0\u00b1\u0406\u0456\u0491\u00b5\u00b6\u00b7\u0451\u2116\u0454\u00bb\u0458\u0405\u0455\u0457\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u042f\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044b\u044c\u044d\u044e\u044f"; -const charset = "windows-1251"; +const aliases = [ "windows-1251", "x-cp1251", "cp1251", "ansi-1251" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_CP1252.js b/intl/uconv/tests/unit/test_decode_CP1252.js index b8c0161ecbef..fd7efc616949 100644 --- a/intl/uconv/tests/unit/test_decode_CP1252.js +++ b/intl/uconv/tests/unit/test_decode_CP1252.js @@ -1,19 +1,13 @@ // Tests conversion from windows-1252 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u201a\u0192\u201e\u2026\u2020\u2021\u02c6\u2030\u0160\u2039\u0152\u017d\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\u0161\u203a\u0153\u017e\u0178\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf\u00d0\u00d1\u00d2\u00d3\u00d4\u00d5\u00d6\u00d7\u00d8\u00d9\u00da\u00db\u00dc\u00dd\u00de\u00df\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed\u00ee\u00ef\u00f0\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u00f7\u00f8\u00f9\u00fa\u00fb\u00fc\u00fd\u00fe\u00ff"; -const charset = "windows-1252"; +const aliases = [ "windows-1252", "x-cp1252", "cp1252" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_CP1253.js b/intl/uconv/tests/unit/test_decode_CP1253.js index 7cd65ea1e5a3..e9e767942025 100644 --- a/intl/uconv/tests/unit/test_decode_CP1253.js +++ b/intl/uconv/tests/unit/test_decode_CP1253.js @@ -1,19 +1,13 @@ // Tests conversion from windows-1253 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u201a\u0192\u201e\u2026\u2020\u2021\u2030\u2039\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u2122\u203a\u00a0\u0385\u0386\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00ab\u00ac\u00ad\u00ae\u2015\u00b0\u00b1\u00b2\u00b3\u0384\u00b5\u00b6\u00b7\u0388\u0389\u038a\u00bb\u038c\u00bd\u038e\u038f\u0390\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9\u03aa\u03ab\u03ac\u03ad\u03ae\u03af\u03b0\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9\u03ca\u03cb\u03cc\u03cd\u03ce"; -const charset = "windows-1253"; +const aliases = [ "windows-1253", "x-cp1253", "cp1253" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_CP1254.js b/intl/uconv/tests/unit/test_decode_CP1254.js index 191ac3a4ceb2..ac2fcb7958b3 100644 --- a/intl/uconv/tests/unit/test_decode_CP1254.js +++ b/intl/uconv/tests/unit/test_decode_CP1254.js @@ -1,19 +1,13 @@ // Tests conversion from windows-1254 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u201a\u0192\u201e\u2026\u2020\u2021\u02c6\u2030\u0160\u2039\u0152\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\u0161\u203a\u0153\u0178\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf\u011e\u00d1\u00d2\u00d3\u00d4\u00d5\u00d6\u00d7\u00d8\u00d9\u00da\u00db\u00dc\u0130\u015e\u00df\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed\u00ee\u00ef\u011f\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u00f7\u00f8\u00f9\u00fa\u00fb\u00fc\u0131\u015f\u00ff"; -const charset = "windows-1254"; +const aliases = [ "windows-1254", "x-cp1254", "cp1254" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_CP1255.js b/intl/uconv/tests/unit/test_decode_CP1255.js index eff51833fb12..87e83875bdb9 100644 --- a/intl/uconv/tests/unit/test_decode_CP1255.js +++ b/intl/uconv/tests/unit/test_decode_CP1255.js @@ -1,19 +1,13 @@ // Tests conversion from windows-1255 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u201a\u0192\u201e\u2026\u2020\u2021\u02c6\u2030\u2039\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\u203a\u00a0\u00a1\u00a2\u00a3\u20aa\u00a5\u00a6\u00a7\u00a8\u00a9\u00d7\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00f7\u00bb\u00bc\u00bd\u00be\u00bf\u05b0\u05b1\u05b2\u05b3\u05b4\u05b5\u05b6\u05b7\u05b8\u05b9\u05bb\u05bc\u05bd\u05be\u05bf\u05c0\u05c1\u05c2\u05c3\u05f0\u05f1\u05f2\u05f3\u05f4\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5\u05d6\u05d7\u05d8\u05d9\u05da\u05db\u05dc\u05dd\u05de\u05df\u05e0\u05e1\u05e2\u05e3\u05e4\u05e5\u05e6\u05e7\u05e8\u05e9\u05ea\u200e\u200f"; -const charset = "windows-1255"; +const aliases = [ "windows-1255", "x-cp1255", "cp1255" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_CP1256.js b/intl/uconv/tests/unit/test_decode_CP1256.js index 003dbf105477..c6a64cba6a5f 100644 --- a/intl/uconv/tests/unit/test_decode_CP1256.js +++ b/intl/uconv/tests/unit/test_decode_CP1256.js @@ -1,19 +1,13 @@ // Tests conversion from windows-1256 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u067e\u201a\u0192\u201e\u2026\u2020\u2021\u02c6\u2030\u0679\u2039\u0152\u0686\u0698\u0688\u06af\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u06a9\u2122\u0691\u203a\u0153\u200c\u200d\u06ba\u00a0\u060c\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u06be\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u061b\u00bb\u00bc\u00bd\u00be\u061f\u06c1\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062a\u062b\u062c\u062d\u062e\u062f\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u00d7\u0637\u0638\u0639\u063a\u0640\u0641\u0642\u0643\u00e0\u0644\u00e2\u0645\u0646\u0647\u0648\u00e7\u00e8\u00e9\u00ea\u00eb\u0649\u064a\u00ee\u00ef\u064b\u064c\u064d\u064e\u00f4\u064f\u0650\u00f7\u0651\u00f9\u0652\u00fb\u00fc\u200e\u200f\u06d2"; -const charset = "windows-1256"; +const aliases = [ "windows-1256", "x-cp1256", "cp1256" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_CP1257.js b/intl/uconv/tests/unit/test_decode_CP1257.js index ba7e8e8057b8..2e2f38ac1d9a 100644 --- a/intl/uconv/tests/unit/test_decode_CP1257.js +++ b/intl/uconv/tests/unit/test_decode_CP1257.js @@ -1,19 +1,13 @@ // Tests conversion from windows-1257 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u201a\u201e\u2026\u2020\u2021\u2030\u2039\u00a8\u02c7\u00b8\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u2122\u203a\u00af\u02db\u00a0\u00a2\u00a3\u00a4\u00a6\u00a7\u00d8\u00a9\u0156\u00ab\u00ac\u00ad\u00ae\u00c6\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00f8\u00b9\u0157\u00bb\u00bc\u00bd\u00be\u00e6\u0104\u012e\u0100\u0106\u00c4\u00c5\u0118\u0112\u010c\u00c9\u0179\u0116\u0122\u0136\u012a\u013b\u0160\u0143\u0145\u00d3\u014c\u00d5\u00d6\u00d7\u0172\u0141\u015a\u016a\u00dc\u017b\u017d\u00df\u0105\u012f\u0101\u0107\u00e4\u00e5\u0119\u0113\u010d\u00e9\u017a\u0117\u0123\u0137\u012b\u013c\u0161\u0144\u0146\u00f3\u014d\u00f5\u00f6\u00f7\u0173\u0142\u015b\u016b\u00fc\u017c\u017e\u02d9"; -const charset = "windows-1257"; +const aliases = [ "windows-1257", "x-cp1257", "cp1257" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_CP1258.js b/intl/uconv/tests/unit/test_decode_CP1258.js index 6f81af72c65f..be4bb7b39bd3 100644 --- a/intl/uconv/tests/unit/test_decode_CP1258.js +++ b/intl/uconv/tests/unit/test_decode_CP1258.js @@ -1,19 +1,13 @@ // Tests conversion from windows-1258 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u201a\u0192\u201e\u2026\u2020\u2021\u02c6\u2030\u2039\u0152\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\u203a\u0153\u0178\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u0102\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u0300\u00cd\u00ce\u00cf\u0110\u00d1\u0309\u00d3\u00d4\u01a0\u00d6\u00d7\u00d8\u00d9\u00da\u00db\u00dc\u01af\u0303\u00df\u00e0\u00e1\u00e2\u0103\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u0301\u00ed\u00ee\u00ef\u0111\u00f1\u0323\u00f3\u00f4\u01a1\u00f6\u00f7\u00f8\u00f9\u00fa\u00fb\u00fc\u01b0\u20ab\u00ff"; -const charset = "windows-1258"; +const aliases = [ "windows-1258", "x-cp1258", "cp1258" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_CP850.js b/intl/uconv/tests/unit/test_decode_CP850.js index 69528328f9a3..36af11389858 100644 --- a/intl/uconv/tests/unit/test_decode_CP850.js +++ b/intl/uconv/tests/unit/test_decode_CP850.js @@ -1,22 +1,13 @@ // Tests conversion from IBM850 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u00c1\u00c2\u00c0\u00a9\u2563\u2551\u2557\u255d\u00a2\u00a5\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u00e3\u00c3\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u00a4\u00f0\u00d0\u00ca\u00cb\u00c8\u20ac\u00cd\u00ce\u00cf\u2518\u250c\u2588\u2584\u00a6\u00cc\u2580\u00d3\u00df\u00d4\u00d2\u00f5\u00d5\u00b5\u00fe\u00de\u00da\u00db\u00d9\u00fd\u00dd\u00af\u00b4\u00ad\u00b1\u2017\u00be\u00b6\u00a7\u00f7\u00b8\u00b0\u00a8\u00b7\u00b9\u00b3\u00b2\u25a0\u00a0"; -function test_conversion(converter, charset) { - converter.charset = charset; - return converter.ConvertToUnicode(inString) + converter.Finish(); -} +const aliases = [ "IBM850", "ibm850", "cp850", "850", "csibm850" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - var converter = new ScriptableUnicodeConverter(); - - do_check_eq(test_conversion(converter, "IBM850"), expectedString); - do_check_eq(test_conversion(converter, "csIBM850"), expectedString); - do_check_eq(test_conversion(converter, "CP850"), expectedString); - do_check_eq(test_conversion(converter, "850"), expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_CP852.js b/intl/uconv/tests/unit/test_decode_CP852.js index be69b9e345cb..630e6788da9e 100644 --- a/intl/uconv/tests/unit/test_decode_CP852.js +++ b/intl/uconv/tests/unit/test_decode_CP852.js @@ -1,22 +1,13 @@ // Tests conversion from IBM852 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c7\u00fc\u00e9\u00e2\u00e4\u016f\u0107\u00e7\u0142\u00eb\u0150\u0151\u00ee\u0179\u00c4\u0106\u00c9\u0139\u013a\u00f4\u00f6\u013d\u013e\u015a\u015b\u00d6\u00dc\u0164\u0165\u0141\u00d7\u010d\u00e1\u00ed\u00f3\u00fa\u0104\u0105\u017d\u017e\u0118\u0119\u20ac\u017a\u010c\u015f\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u00c1\u00c2\u011a\u015e\u2563\u2551\u2557\u255d\u017b\u017c\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u0102\u0103\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u00a4\u0111\u0110\u010e\u00cb\u010f\u0147\u00cd\u00ce\u011b\u2518\u250c\u2588\u2584\u0162\u016e\u2580\u00d3\u00df\u00d4\u0143\u0144\u0148\u0160\u0161\u0154\u00da\u0155\u0170\u00fd\u00dd\u0163\u00b4\u00ad\u02dd\u02db\u02c7\u02d8\u00a7\u00f7\u00b8\u00b0\u00a8\u02d9\u0171\u0158\u0159\u25a0\u00a0"; -function test_conversion(converter, charset) { - converter.charset = charset; - return converter.ConvertToUnicode(inString) + converter.Finish(); -} +const aliases = [ "IBM852", "ibm852", "cp852", "852", "csibm852" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - var converter = new ScriptableUnicodeConverter(); - - do_check_eq(test_conversion(converter, "IBM852"), expectedString); - do_check_eq(test_conversion(converter, "csIBM852"), expectedString); - do_check_eq(test_conversion(converter, "CP852"), expectedString); - do_check_eq(test_conversion(converter, "852"), expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_CP855.js b/intl/uconv/tests/unit/test_decode_CP855.js index 7d8517f4405d..8d379c8dca59 100644 --- a/intl/uconv/tests/unit/test_decode_CP855.js +++ b/intl/uconv/tests/unit/test_decode_CP855.js @@ -1,22 +1,13 @@ // Tests conversion from IBM855 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0452\u0402\u0453\u0403\u0451\u0401\u0454\u0404\u0455\u0405\u0456\u0406\u0457\u0407\u0458\u0408\u0459\u0409\u045a\u040a\u045b\u040b\u045c\u040c\u045e\u040e\u045f\u040f\u044e\u042e\u044a\u042a\u0430\u0410\u0431\u0411\u0446\u0426\u0434\u0414\u0435\u0415\u0444\u0424\u0433\u0413\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u0445\u0425\u0438\u0418\u2563\u2551\u2557\u255d\u0439\u0419\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u043a\u041a\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u00a4\u043b\u041b\u043c\u041c\u043d\u041d\u043e\u041e\u043f\u2518\u250c\u2588\u2584\u041f\u044f\u2580\u042f\u0440\u0420\u0441\u0421\u0442\u0422\u0443\u0423\u0436\u0416\u0432\u0412\u044c\u042c\u2116\u00ad\u044b\u042b\u0437\u0417\u0448\u0428\u044d\u042d\u0449\u0429\u0447\u0427\u00a7\u25a0\u00a0"; -function test_conversion(converter, charset) { - converter.charset = charset; - return converter.ConvertToUnicode(inString) + converter.Finish(); -} +const aliases = [ "IBM855", "ibm855", "cp855", "855", "csibm855" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - var converter = new ScriptableUnicodeConverter(); - - do_check_eq(test_conversion(converter, "IBM855"), expectedString); - do_check_eq(test_conversion(converter, "csIBM855"), expectedString); - do_check_eq(test_conversion(converter, "CP855"), expectedString); - do_check_eq(test_conversion(converter, "855"), expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_CP857.js b/intl/uconv/tests/unit/test_decode_CP857.js index ebfc399d096f..e58c7619a9f0 100644 --- a/intl/uconv/tests/unit/test_decode_CP857.js +++ b/intl/uconv/tests/unit/test_decode_CP857.js @@ -1,22 +1,13 @@ // Tests conversion from IBM857 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u0131\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u0130\u00d6\u00dc\u00f8\u00a3\u00d8\u015e\u015f\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u011e\u011f\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u00c1\u00c2\u00c0\u00a9\u2563\u2551\u2557\u255d\u00a2\u00a5\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u00e3\u00c3\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u00a4\u00ba\u00aa\u00ca\u00cb\u00c8\u20ac\u00cd\u00ce\u00cf\u2518\u250c\u2588\u2584\u00a6\u00cc\u2580\u00d3\u00df\u00d4\u00d2\u00f5\u00d5\u00b5\u00d7\u00da\u00db\u00d9\u00ec\u00ff\u00af\u00b4\u00ad\u00b1\u00be\u00b6\u00a7\u00f7\u00b8\u00b0\u00a8\u00b7\u00b9\u00b3\u00b2\u25a0\u00a0"; -function test_conversion(converter, charset) { - converter.charset = charset; - return converter.ConvertToUnicode(inString) + converter.Finish(); -} +const aliases = [ "IBM857", "ibm857", "cp857", "857", "csibm857" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - var converter = new ScriptableUnicodeConverter(); - - do_check_eq(test_conversion(converter, "IBM857"), expectedString); - do_check_eq(test_conversion(converter, "csIBM857"), expectedString); - do_check_eq(test_conversion(converter, "CP857"), expectedString); - do_check_eq(test_conversion(converter, "857"), expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_CP862.js b/intl/uconv/tests/unit/test_decode_CP862.js index c800a252220c..6c66bcc24485 100644 --- a/intl/uconv/tests/unit/test_decode_CP862.js +++ b/intl/uconv/tests/unit/test_decode_CP862.js @@ -1,22 +1,13 @@ // Tests conversion from IBM862 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5\u05d6\u05d7\u05d8\u05d9\u05da\u05db\u05dc\u05dd\u05de\u05df\u05e0\u05e1\u05e2\u05e3\u05e4\u05e5\u05e6\u05e7\u05e8\u05e9\u05ea\u00a2\u00a3\u00a5\u20aa\u200e\u200f\u202a\u202b\u202d\u202c\u202e\u2310\u00ac\u00bd\u00bc\u20ac\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u00df\u0393\u03c0\u03a3\u03c3\u00b5\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u03c6\u03b5\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u00a0"; -function test_conversion(converter, charset) { - converter.charset = charset; - return converter.ConvertToUnicode(inString) + converter.Finish(); -} +const aliases = [ "IBM862", "ibm862", "cp862", "862", "csibm862" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - var converter = new ScriptableUnicodeConverter(); - - do_check_eq(test_conversion(converter, "IBM862"), expectedString); - do_check_eq(test_conversion(converter, "csIBM862"), expectedString); - do_check_eq(test_conversion(converter, "CP862"), expectedString); - do_check_eq(test_conversion(converter, "862"), expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_CP864.js b/intl/uconv/tests/unit/test_decode_CP864.js index 965ca480dbab..86c38cedf064 100644 --- a/intl/uconv/tests/unit/test_decode_CP864.js +++ b/intl/uconv/tests/unit/test_decode_CP864.js @@ -1,22 +1,13 @@ // Tests conversion from IBM864 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$\u066a&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00b0\u00b7\u2219\u221a\u2592\u2500\u2502\u253c\u2524\u252c\u251c\u2534\u2510\u250c\u2514\u2518\u03b2\u221e\u03c6\u00b1\u00bd\u00bc\u2248\u00ab\u00bb\ufef7\ufef8\ufefb\ufefc\u00a0\u00ad\ufe82\u00a3\u00a4\ufe84\u20ac\ufe8e\ufe8f\ufe95\ufe99\u060c\ufe9d\ufea1\ufea5\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\ufed1\u061b\ufeb1\ufeb5\ufeb9\u061f\u00a2\ufe80\ufe81\ufe83\ufe85\ufeca\ufe8b\ufe8d\ufe91\ufe93\ufe97\ufe9b\ufe9f\ufea3\ufea7\ufea9\ufeab\ufead\ufeaf\ufeb3\ufeb7\ufebb\ufebf\ufec1\ufec5\ufecb\ufecf\u00a6\u00ac\u00f7\u00d7\ufec9\u0640\ufed3\ufed7\ufedb\ufedf\ufee3\ufee7\ufeeb\ufeed\ufeef\ufef3\ufebd\ufecc\ufece\ufecd\ufee1\ufe7d\u0651\ufee5\ufee9\ufeec\ufef0\ufef2\ufed0\ufed5\ufef5\ufef6\ufedd\ufed9\ufef1\u25a0"; -function test_conversion(converter, charset) { - converter.charset = charset; - return converter.ConvertToUnicode(inString) + converter.Finish(); -} +const aliases = [ "IBM864", "ibm864", "cp864", "864", "csibm864", "ibm-864" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - var converter = new ScriptableUnicodeConverter(); - - do_check_eq(test_conversion(converter, "IBM864"), expectedString); - do_check_eq(test_conversion(converter, "csIBM864"), expectedString); - do_check_eq(test_conversion(converter, "CP864"), expectedString); - do_check_eq(test_conversion(converter, "864"), expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_CP874.js b/intl/uconv/tests/unit/test_decode_CP874.js index 483ab81f503f..9b98804c5a4d 100644 --- a/intl/uconv/tests/unit/test_decode_CP874.js +++ b/intl/uconv/tests/unit/test_decode_CP874.js @@ -1,19 +1,13 @@ // Tests conversion from windows-874 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u2026\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u00a0\u0e01\u0e02\u0e03\u0e04\u0e05\u0e06\u0e07\u0e08\u0e09\u0e0a\u0e0b\u0e0c\u0e0d\u0e0e\u0e0f\u0e10\u0e11\u0e12\u0e13\u0e14\u0e15\u0e16\u0e17\u0e18\u0e19\u0e1a\u0e1b\u0e1c\u0e1d\u0e1e\u0e1f\u0e20\u0e21\u0e22\u0e23\u0e24\u0e25\u0e26\u0e27\u0e28\u0e29\u0e2a\u0e2b\u0e2c\u0e2d\u0e2e\u0e2f\u0e30\u0e31\u0e32\u0e33\u0e34\u0e35\u0e36\u0e37\u0e38\u0e39\u0e3a\u0e3f\u0e40\u0e41\u0e42\u0e43\u0e44\u0e45\u0e46\u0e47\u0e48\u0e49\u0e4a\u0e4b\u0e4c\u0e4d\u0e4e\u0e4f\u0e50\u0e51\u0e52\u0e53\u0e54\u0e55\u0e56\u0e57\u0e58\u0e59\u0e5a\u0e5b"; -const charset = "windows-874"; +const aliases = [ "windows-874", "ibm874" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_armscii.js b/intl/uconv/tests/unit/test_decode_armscii.js index fc724e1c9e0e..b5ec77634819 100644 --- a/intl/uconv/tests/unit/test_decode_armscii.js +++ b/intl/uconv/tests/unit/test_decode_armscii.js @@ -1,19 +1,13 @@ // Tests conversion from armscii-8 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0587\u0589)(\u00bb\u00ab\u2014.\u055d,-\u058a\u2026\u055c\u055b\u055e\u0531\u0561\u0532\u0562\u0533\u0563\u0534\u0564\u0535\u0565\u0536\u0566\u0537\u0567\u0538\u0568\u0539\u0569\u053a\u056a\u053b\u056b\u053c\u056c\u053d\u056d\u053e\u056e\u053f\u056f\u0540\u0570\u0541\u0571\u0542\u0572\u0543\u0573\u0544\u0574\u0545\u0575\u0546\u0576\u0547\u0577\u0548\u0578\u0549\u0579\u054a\u057a\u054b\u057b\u054c\u057c\u054d\u057d\u054e\u057e\u054f\u057f\u0550\u0580\u0551\u0581\u0552\u0582\u0553\u0583\u0554\u0584\u0555\u0585\u0556\u0586\u055a"; -const charset = "armscii-8"; +const aliases = ["armscii-8"]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_geostd8.js b/intl/uconv/tests/unit/test_decode_geostd8.js index efe4c77b0cdc..18a33f64c9ad 100644 --- a/intl/uconv/tests/unit/test_decode_geostd8.js +++ b/intl/uconv/tests/unit/test_decode_geostd8.js @@ -1,19 +1,13 @@ // Tests conversion from geostd8 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u201a\u201e\u2026\u2020\u2021\u2030\u2039\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u203a\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u10d0\u10d1\u10d2\u10d3\u10d4\u10d5\u10d6\u10f1\u10d7\u10d8\u10d9\u10da\u10db\u10dc\u10f2\u10dd\u10de\u10df\u10e0\u10e1\u10e2\u10f3\u10e3\u10e4\u10e5\u10e6\u10e7\u10e8\u10e9\u10ea\u10eb\u10ec\u10ed\u10ee\u10f4\u10ef\u10f0\u10f5\u2116"; -const charset = "geostd8"; +const aliases = ["GEOSTD8"]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_tcvn5712.js b/intl/uconv/tests/unit/test_decode_tcvn5712.js index 8d536208ce9a..aaa477bdf333 100644 --- a/intl/uconv/tests/unit/test_decode_tcvn5712.js +++ b/intl/uconv/tests/unit/test_decode_tcvn5712.js @@ -1,19 +1,13 @@ // Tests conversion from x-viet-tcvn5712 to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = "\u00da\u1ee4\u1eea\u1eec\u1eee\u1ee8\u1ef0\u1ef2\u1ef6\u1ef8\u00dd\u1ef4 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c0\u1ea2\u00c3\u00c1\u1ea0\u1eb6\u1eac\u00c8\u1eba\u1ebc\u00c9\u1eb8\u1ec6\u00cc\u1ec8\u0128\u00cd\u1eca\u00d2\u1ece\u00d5\u00d3\u1ecc\u1ed8\u1edc\u1ede\u1ee0\u1eda\u1ee2\u00d9\u1ee6\u0168\u00a0\u0102\u00c2\u00ca\u00d4\u01a0\u01af\u0110\u0103\u00e2\u00ea\u00f4\u01a1\u01b0\u0111\u1eb0\u0300\u0309\u0303\u0301\u0323\u00e0\u1ea3\u00e3\u00e1\u1ea1\u1eb2\u1eb1\u1eb3\u1eb5\u1eaf\u1eb4\u1eae\u1ea6\u1ea8\u1eaa\u1ea4\u1ec0\u1eb7\u1ea7\u1ea9\u1eab\u1ea5\u1ead\u00e8\u1ec2\u1ebb\u1ebd\u00e9\u1eb9\u1ec1\u1ec3\u1ec5\u1ebf\u1ec7\u00ec\u1ec9\u1ec4\u1ebe\u1ed2\u0129\u00ed\u1ecb\u00f2\u1ed4\u1ecf\u00f5\u00f3\u1ecd\u1ed3\u1ed5\u1ed7\u1ed1\u1ed9\u1edd\u1edf\u1ee1\u1edb\u1ee3\u00f9\u1ed6\u1ee7\u0169\u00fa\u1ee5\u1eeb\u1eed\u1eef\u1ee9\u1ef1\u1ef3\u1ef7\u1ef9\u00fd\u1ef5\u1ed0"; -const charset = "x-viet-tcvn5712"; +const aliases = [ "x-viet-tcvn5712" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_viscii.js b/intl/uconv/tests/unit/test_decode_viscii.js index 290f8dd76038..2892c077e7a4 100644 --- a/intl/uconv/tests/unit/test_decode_viscii.js +++ b/intl/uconv/tests/unit/test_decode_viscii.js @@ -1,19 +1,13 @@ // Tests conversion from viscii to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = "\u1eb2\u1eb4\u1eaa\u1ef6\u1ef8\u1ef4 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u1ea0\u1eae\u1eb0\u1eb6\u1ea4\u1ea6\u1ea8\u1eac\u1ebc\u1eb8\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1ee2\u1eda\u1edc\u1ede\u1eca\u1ece\u1ecc\u1ec8\u1ee6\u0168\u1ee4\u1ef2\u00d5\u1eaf\u1eb1\u1eb7\u1ea5\u1ea7\u1ea9\u1ead\u1ebd\u1eb9\u1ebf\u1ec1\u1ec3\u1ec5\u1ec7\u1ed1\u1ed3\u1ed5\u1ed7\u1ee0\u01a0\u1ed9\u1edd\u1edf\u1ecb\u1ef0\u1ee8\u1eea\u1eec\u01a1\u1edb\u01af\u00c0\u00c1\u00c2\u00c3\u1ea2\u0102\u1eb3\u1eb5\u00c8\u00c9\u00ca\u1eba\u00cc\u00cd\u0128\u1ef3\u0110\u1ee9\u00d2\u00d3\u00d4\u1ea1\u1ef7\u1eeb\u1eed\u00d9\u00da\u1ef9\u1ef5\u00dd\u1ee1\u01b0\u00e0\u00e1\u00e2\u00e3\u1ea3\u0103\u1eef\u1eab\u00e8\u00e9\u00ea\u1ebb\u00ec\u00ed\u0129\u1ec9\u0111\u1ef1\u00f2\u00f3\u00f4\u00f5\u1ecf\u1ecd\u1ee5\u00f9\u00fa\u0169\u1ee7\u00fd\u1ee3\u1eee"; -const charset = "viscii"; +const aliases = [ "VISCII", "viscii", "csviscii" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_vps.js b/intl/uconv/tests/unit/test_decode_vps.js index 24ecf0a6254f..f3b3d0032677 100644 --- a/intl/uconv/tests/unit/test_decode_vps.js +++ b/intl/uconv/tests/unit/test_decode_vps.js @@ -1,19 +1,13 @@ // Tests conversion from x-viet-vps to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = "\u1ea0\u1eac\u1eb6\u1eb8\u1ec6\u1eca\u1ecc\u1ed8\u1ee2\u1ee4\u1ef0\u1ef4\u1eaa\u1eee !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c0\u1ea2\u00c3\u1ea4\u1ea6\u1ea8\u1ecd\u1ed7\u0102\u1ebf\u1ec1\u1ec3\u1ec7\u1eae\u1eb0\u1eb2\u1ebe\u2018\u2019\u1ec0\u1ec2\u1ec4\u1ed0\u1ed2\u1ed4\u1ed6\u00fd\u1ef7\u1ef5\u1eda\u1edc\u1ede\u00a0\u1eaf\u1eb1\u1eb3\u1eb5\u1eb7\u1ee0\u1edb\u00d9\u1edd\u1edf\u1ee1\u0168\u1ee8\u1ee3\u1eea\u1ed5\u1eec\u1ef2\u1ef8\u00cd\u00cc\u1ed9\u1ec8\u0128\u00d3\u1eed\u1eef\u00d2\u1ece\u00d5\u1ef1\u1ea7\u00c1\u00c2\u1ea5\u1ea9\u1eab\u1ead\u0111\u1ebb\u00c9\u00ca\u1eb9\u1ec9\u1ec5\u1ecb\u1ef9\u01af\u1ee6\u1ed3\u1ed1\u00d4\u1ecf\u01a1\u00c8\u1eeb\u1ee9\u00da\u0169\u01b0\u00dd\u1eba\u00df\u00e0\u00e1\u00e2\u00e3\u1ea3\u1ea1\u0103\u00e7\u00e8\u00e9\u00ea\u1ebd\u00ec\u00ed\u00ee\u0129\u1eb4\u0110\u00f2\u00f3\u00f4\u00f5\u00f6\u01a0\u1ee5\u00f9\u00fa\u1ee7\u00fc\u1ef6\u1ebc\u1ef3"; -const charset = "x-viet-vps"; +const aliases = [ "x-viet-vps" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_x_mac_arabic.js b/intl/uconv/tests/unit/test_decode_x_mac_arabic.js index 531f188f7d70..a3f89e7d74c0 100644 --- a/intl/uconv/tests/unit/test_decode_x_mac_arabic.js +++ b/intl/uconv/tests/unit/test_decode_x_mac_arabic.js @@ -1,19 +1,13 @@ // Tests conversion from x-mac-arabic to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\u00a0\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u06ba\u00ab\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u2026\u00ee\u00ef\u00f1\u00f3\u00bb\u00f4\u00f6\u00f7\u00fa\u00f9\u00fb\u00fc !\"#$\u066a&'()*+\u060c-./\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669:\u061b<=>\u061f\u274a\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062a\u062b\u062c\u062d\u062e\u062f\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063a[\\]^_\u0640\u0641\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064a\u064b\u064c\u064d\u064e\u064f\u0650\u0651\u0652\u067e\u0679\u0686\u06d5\u06a4\u06af\u0688\u0691{|}\u0698\u06d2"; -const charset = "x-mac-arabic"; +const aliases = [ "x-mac-arabic" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_x_mac_ce.js b/intl/uconv/tests/unit/test_decode_x_mac_ce.js index 16184a3cba65..47060cb8e8ba 100644 --- a/intl/uconv/tests/unit/test_decode_x_mac_ce.js +++ b/intl/uconv/tests/unit/test_decode_x_mac_ce.js @@ -1,19 +1,13 @@ // Tests conversion from x-mac-ce to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\u0100\u0101\u00c9\u0104\u00d6\u00dc\u00e1\u0105\u010c\u00e4\u010d\u0106\u0107\u00e9\u0179\u017a\u010e\u00ed\u010f\u0112\u0113\u0116\u00f3\u0117\u00f4\u00f6\u00f5\u00fa\u011a\u011b\u00fc\u2020\u00b0\u0118\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u0119\u00a8\u2260\u0123\u012e\u012f\u012a\u2264\u2265\u012b\u0136\u2202\u2211\u0142\u013b\u013c\u013d\u013e\u0139\u013a\u0145\u0146\u0143\u00ac\u221a\u0144\u0147\u2206\u00ab\u00bb\u2026\u00a0\u0148\u0150\u00d5\u0151\u014c\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u014d\u0154\u0155\u0158\u2039\u203a\u0159\u0156\u0157\u0160\u201a\u201e\u0161\u015a\u015b\u00c1\u0164\u0165\u00cd\u017d\u017e\u016a\u00d3\u00d4\u016b\u016e\u00da\u016f\u0170\u0171\u0172\u0173\u00dd\u00fd\u0137\u017b\u0141\u017c\u0122\u02c7"; -const charset = "x-mac-ce"; +const aliases = [ "x-mac-ce" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_x_mac_croatian.js b/intl/uconv/tests/unit/test_decode_x_mac_croatian.js index 7afdb8632751..5d1be8398e7f 100644 --- a/intl/uconv/tests/unit/test_decode_x_mac_croatian.js +++ b/intl/uconv/tests/unit/test_decode_x_mac_croatian.js @@ -1,19 +1,13 @@ // Tests conversion from x-mac-croatian to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u0160\u2122\u00b4\u00a8\u2260\u017d\u00d8\u221e\u00b1\u2264\u2265\u2206\u00b5\u2202\u2211\u220f\u0161\u222b\u00aa\u00ba\u03a9\u017e\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u0106\u00ab\u010c\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u0110\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\uf8ff\u00a9\u2044\u20ac\u2039\u203a\u00c6\u00bb\u2013\u00b7\u201a\u201e\u2030\u00c2\u0107\u00c1\u010d\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\u0111\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u03c0\u00cb\u02da\u00b8\u00ca\u00e6\u02c7"; -const charset = "x-mac-croatian"; +const aliases = [ "x-mac-croatian" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_x_mac_cyrillic.js b/intl/uconv/tests/unit/test_decode_x_mac_cyrillic.js index afa403d1ba3b..be7ef156f8c6 100644 --- a/intl/uconv/tests/unit/test_decode_x_mac_cyrillic.js +++ b/intl/uconv/tests/unit/test_decode_x_mac_cyrillic.js @@ -1,19 +1,13 @@ // Tests conversion from x-mac-cyrillic to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u042f\u2020\u00b0\u0490\u00a3\u00a7\u2022\u00b6\u0406\u00ae\u00a9\u2122\u0402\u0452\u2260\u0403\u0453\u221e\u00b1\u2264\u2265\u0456\u00b5\u0491\u0408\u0404\u0454\u0407\u0457\u0409\u0459\u040a\u045a\u0458\u0405\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u040b\u045b\u040c\u045c\u0455\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u201e\u040e\u045e\u040f\u045f\u2116\u0401\u0451\u044f\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044b\u044c\u044d\u044e\u20ac"; -const charset = "x-mac-cyrillic"; +const aliases = [ "x-mac-cyrillic" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_x_mac_devanagari.js b/intl/uconv/tests/unit/test_decode_x_mac_devanagari.js index c38fc53472f1..0ad492efae20 100644 --- a/intl/uconv/tests/unit/test_decode_x_mac_devanagari.js +++ b/intl/uconv/tests/unit/test_decode_x_mac_devanagari.js @@ -1,19 +1,13 @@ // Tests conversion from x-mac-devanagari to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00d7\u2212\u2013\u2014\u2018\u2019\u2026\u2022\u00a9\u00ae\u2122\u0965\u0970\u0901\u0902\u0903\u0905\u0906\u0907\u0908\u0909\u090a\u090b\u090e\u090f\u0910\u090d\u0912\u0913\u0914\u0911\u0915\u0916\u0917\u0918\u0919\u091a\u091b\u091c\u091d\u091e\u091f\u0920\u0921\u0922\u0923\u0924\u0925\u0926\u0927\u0928\u0929\u092a\u092b\u092c\u092d\u092e\u092f\u095f\u0930\u0931\u0932\u0933\u0934\u0935\u0936\u0937\u0938\u0939\u200e\u093e\u093f\u0940\u0941\u0942\u0943\u0946\u0947\u0948\u0945\u094a\u094b\u094c\u0949\u094d\u093c\u0964\u0966\u0967\u0968\u0969\u096a\u096b\u096c\u096d\u096e\u096f"; -const charset = "x-mac-devanagari"; +const aliases = [ "x-mac-devanagari" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_x_mac_farsi.js b/intl/uconv/tests/unit/test_decode_x_mac_farsi.js index f204594e1e81..f244e7807767 100644 --- a/intl/uconv/tests/unit/test_decode_x_mac_farsi.js +++ b/intl/uconv/tests/unit/test_decode_x_mac_farsi.js @@ -1,19 +1,13 @@ // Tests conversion from x-mac-farsi to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\u00a0\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u06ba\u00ab\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u2026\u00ee\u00ef\u00f1\u00f3\u00bb\u00f4\u00f6\u00f7\u00fa\u00f9\u00fb\u00fc !\"#$\u066a&'()*+\u060c-./\u06f0\u06f1\u06f2\u06f3\u06f4\u06f5\u06f6\u06f7\u06f8\u06f9:\u061b<=>\u061f\u274a\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062a\u062b\u062c\u062d\u062e\u062f\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063a[\\]^_\u0640\u0641\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064a\u064b\u064c\u064d\u064e\u064f\u0650\u0651\u0652\u067e\u0679\u0686\u06d5\u06a4\u06af\u0688\u0691{|}\u0698\u06d2"; -const charset = "x-mac-farsi"; +const aliases = [ "x-mac-farsi" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_x_mac_greek.js b/intl/uconv/tests/unit/test_decode_x_mac_greek.js index c470b3449cfb..aaa8119bd8a5 100644 --- a/intl/uconv/tests/unit/test_decode_x_mac_greek.js +++ b/intl/uconv/tests/unit/test_decode_x_mac_greek.js @@ -1,19 +1,13 @@ // Tests conversion from x-mac-greek to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\u00b9\u00b2\u00c9\u00b3\u00d6\u00dc\u0385\u00e0\u00e2\u00e4\u0384\u00a8\u00e7\u00e9\u00e8\u00ea\u00eb\u00a3\u2122\u00ee\u00ef\u2022\u00bd\u2030\u00f4\u00f6\u00a6\u20ac\u00f9\u00fb\u00fc\u2020\u0393\u0394\u0398\u039b\u039e\u03a0\u00df\u00ae\u00a9\u03a3\u03aa\u00a7\u2260\u00b0\u00b7\u0391\u00b1\u2264\u2265\u00a5\u0392\u0395\u0396\u0397\u0399\u039a\u039c\u03a6\u03ab\u03a8\u03a9\u03ac\u039d\u00ac\u039f\u03a1\u2248\u03a4\u00ab\u00bb\u2026\u00a0\u03a5\u03a7\u0386\u0388\u0153\u2013\u2015\u201c\u201d\u2018\u2019\u00f7\u0389\u038a\u038c\u038e\u03ad\u03ae\u03af\u03cc\u038f\u03cd\u03b1\u03b2\u03c8\u03b4\u03b5\u03c6\u03b3\u03b7\u03b9\u03be\u03ba\u03bb\u03bc\u03bd\u03bf\u03c0\u03ce\u03c1\u03c3\u03c4\u03b8\u03c9\u03c2\u03c7\u03c5\u03b6\u03ca\u03cb\u0390\u03b0\u00ad"; -const charset = "x-mac-greek"; +const aliases = [ "x-mac-greek" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_x_mac_gujarati.js b/intl/uconv/tests/unit/test_decode_x_mac_gujarati.js index c09c106e0067..14dbf64643f5 100644 --- a/intl/uconv/tests/unit/test_decode_x_mac_gujarati.js +++ b/intl/uconv/tests/unit/test_decode_x_mac_gujarati.js @@ -1,19 +1,13 @@ // Tests conversion from x-mac-gujarati to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00d7\u2212\u2013\u2014\u2018\u2019\u2026\u2022\u00a9\u00ae\u2122\u0965\u0a81\u0a82\u0a83\u0a85\u0a86\u0a87\u0a88\u0a89\u0a8a\u0a8b\u0a8f\u0a90\u0a8d\u0a93\u0a94\u0a91\u0a95\u0a96\u0a97\u0a98\u0a99\u0a9a\u0a9b\u0a9c\u0a9d\u0a9e\u0a9f\u0aa0\u0aa1\u0aa2\u0aa3\u0aa4\u0aa5\u0aa6\u0aa7\u0aa8\u0aaa\u0aab\u0aac\u0aad\u0aae\u0aaf\u0ab0\u0ab2\u0ab3\u0ab5\u0ab6\u0ab7\u0ab8\u0ab9\u200e\u0abe\u0abf\u0ac0\u0ac1\u0ac2\u0ac3\u0ac7\u0ac8\u0ac5\u0acb\u0acc\u0ac9\u0acd\u0abc\u0964\u0ae6\u0ae7\u0ae8\u0ae9\u0aea\u0aeb\u0aec\u0aed\u0aee\u0aef"; -const charset = "x-mac-gujarati"; +const aliases = [ "x-mac-gujarati" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_x_mac_gurmukhi.js b/intl/uconv/tests/unit/test_decode_x_mac_gurmukhi.js index 839b0645d908..3ad695af6219 100644 --- a/intl/uconv/tests/unit/test_decode_x_mac_gurmukhi.js +++ b/intl/uconv/tests/unit/test_decode_x_mac_gurmukhi.js @@ -1,19 +1,13 @@ // Tests conversion from x-mac-gurmukhi to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00d7\u2212\u2013\u2014\u2018\u2019\u2026\u2022\u00a9\u00ae\u2122\u0a71\u0a5c\u0a73\u0a72\u0a74\u0a02\u0a05\u0a06\u0a07\u0a08\u0a09\u0a0a\u0a0f\u0a10\u0a13\u0a14\u0a15\u0a16\u0a17\u0a18\u0a19\u0a1a\u0a1b\u0a1c\u0a1d\u0a1e\u0a1f\u0a20\u0a21\u0a22\u0a23\u0a24\u0a25\u0a26\u0a27\u0a28\u0a2a\u0a2b\u0a2c\u0a2d\u0a2e\u0a2f\u0a30\u0a32\u0a35\uf860\u0a38\u0a39\u200e\u0a3e\u0a3f\u0a40\u0a41\u0a42\u0a47\u0a48\u0a4b\u0a4c\u0a4d\u0a3c\u0964\u0a66\u0a67\u0a68\u0a69\u0a6a\u0a6b\u0a6c\u0a6d\u0a6e\u0a6f"; -const charset = "x-mac-gurmukhi"; +const aliases = [ "x-mac-gurmukhi" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_x_mac_hebrew.js b/intl/uconv/tests/unit/test_decode_x_mac_hebrew.js index f598a1748f1d..88de27934a8f 100644 --- a/intl/uconv/tests/unit/test_decode_x_mac_hebrew.js +++ b/intl/uconv/tests/unit/test_decode_x_mac_hebrew.js @@ -1,19 +1,13 @@ // Tests conversion from x-mac-hebrew to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\ufb1f\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc !\"#$%\u20aa'()*+,-./0123456789:;<=>?\ufffd\u201e\uf89b\uf89c\uf89d\uf89e\u05bc\ufb4b\ufb35\u2026\u00a0\u05b8\u05b7\u05b5\u05b6\u05b4\u2013\u2014\u201c\u201d\u2018\u2019\ufb2a\ufb2b\u05bf\u05b0\u05b2\u05b1\u05bb\u05b9\ufffd\u05b3\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5\u05d6\u05d7\u05d8\u05d9\u05da\u05db\u05dc\u05dd\u05de\u05df\u05e0\u05e1\u05e2\u05e3\u05e4\u05e5\u05e6\u05e7\u05e8\u05e9\u05ea}]{[|"; -const charset = "x-mac-hebrew"; +const aliases = [ "x-mac-hebrew" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_x_mac_icelandic.js b/intl/uconv/tests/unit/test_decode_x_mac_icelandic.js index 3a4c8dbff876..477639406088 100644 --- a/intl/uconv/tests/unit/test_decode_x_mac_icelandic.js +++ b/intl/uconv/tests/unit/test_decode_x_mac_icelandic.js @@ -1,19 +1,13 @@ // Tests conversion from x-mac-icelandic to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u00dd\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u00c6\u00d8\u221e\u00b1\u2264\u2265\u00a5\u00b5\u2202\u2211\u220f\u03c0\u222b\u00aa\u00ba\u03a9\u00e6\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u00ff\u0178\u2044\u20ac\u00d0\u00f0\u00de\u00fe\u00fd\u00b7\u201a\u201e\u2030\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\uf8ff\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u02d8\u02d9\u02da\u00b8\u02dd\u02db\u02c7"; -const charset = "x-mac-icelandic"; +const aliases = [ "x-mac-icelandic" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_x_mac_roman.js b/intl/uconv/tests/unit/test_decode_x_mac_roman.js index 879c9df26c1f..078cc4c51bee 100644 --- a/intl/uconv/tests/unit/test_decode_x_mac_roman.js +++ b/intl/uconv/tests/unit/test_decode_x_mac_roman.js @@ -1,22 +1,13 @@ // Tests conversion from x-mac-roman to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u00c6\u00d8\u221e\u00b1\u2264\u2265\u00a5\u00b5\u2202\u2211\u220f\u03c0\u222b\u00aa\u00ba\u03a9\u00e6\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u00ff\u0178\u2044\u20ac\u2039\u203a\ufb01\ufb02\u2021\u00b7\u201a\u201e\u2030\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\uf8ff\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u02d8\u02d9\u02da\u00b8\u02dd\u02db\u02c7"; -function test_conversion(converter, charset) { - converter.charset = charset; - return converter.ConvertToUnicode(inString) + converter.Finish(); -} +const aliases = [ "csMacintosh", "mac", "macintosh", "x-mac-roman" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - var converter = new ScriptableUnicodeConverter(); - - do_check_eq(test_conversion(converter, "x-mac-roman"), expectedString); - do_check_eq(test_conversion(converter, "csMacintosh"), expectedString); - do_check_eq(test_conversion(converter, "macintosh"), expectedString); - do_check_eq(test_conversion(converter, "mac"), expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_x_mac_romanian.js b/intl/uconv/tests/unit/test_decode_x_mac_romanian.js index 244e496bb5d4..2ea318fbe9f2 100644 --- a/intl/uconv/tests/unit/test_decode_x_mac_romanian.js +++ b/intl/uconv/tests/unit/test_decode_x_mac_romanian.js @@ -1,19 +1,13 @@ // Tests conversion from x-mac-romanian to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u0102\u0218\u221e\u00b1\u2264\u2265\u00a5\u00b5\u2202\u2211\u220f\u03c0\u222b\u00aa\u00ba\u03a9\u0103\u0219\u00bf\u00a1\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u00ff\u0178\u2044\u20ac\u2039\u203a\u021a\u021b\u2021\u00b7\u201a\u201e\u2030\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\uf8ff\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u02d8\u02d9\u02da\u00b8\u02dd\u02db\u02c7"; -const charset = "x-mac-romanian"; +const aliases = [ "x-mac-romanian" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_x_mac_turkish.js b/intl/uconv/tests/unit/test_decode_x_mac_turkish.js index f8f2722e3819..ccc7d234724c 100644 --- a/intl/uconv/tests/unit/test_decode_x_mac_turkish.js +++ b/intl/uconv/tests/unit/test_decode_x_mac_turkish.js @@ -1,19 +1,13 @@ // Tests conversion from x-mac-turkish to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u00c6\u00d8\u221e\u00b1\u2264\u2265\u00a5\u00b5\u2202\u2211\u220f\u03c0\u222b\u00aa\u00ba\u03a9\u00e6\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u00ff\u0178\u011e\u011f\u0130\u0131\u015e\u015f\u2021\u00b7\u201a\u201e\u2030\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\uf8ff\u00d2\u00da\u00db\u00d9\uf8a0\u02c6\u02dc\u00af\u02d8\u02d9\u02da\u00b8\u02dd\u02db\u02c7"; -const charset = "x-mac-turkish"; +const aliases = [ "x-mac-turkish" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_decode_x_mac_ukrainian.js b/intl/uconv/tests/unit/test_decode_x_mac_ukrainian.js index 7dfae69e0278..cc60570fe4a8 100644 --- a/intl/uconv/tests/unit/test_decode_x_mac_ukrainian.js +++ b/intl/uconv/tests/unit/test_decode_x_mac_ukrainian.js @@ -1,19 +1,13 @@ // Tests conversion from x-mac-ukrainian to Unicode +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u042f\u2020\u00b0\u0490\u00a3\u00a7\u2022\u00b6\u0406\u00ae\u00a9\u2122\u0402\u0452\u2260\u0403\u0453\u221e\u00b1\u2264\u2265\u0456\u00b5\u0491\u0408\u0404\u0454\u0407\u0457\u0409\u0459\u040a\u045a\u0458\u0405\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u040b\u045b\u040c\u045c\u0455\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u201e\u040e\u045e\u040f\u045f\u2116\u0401\u0451\u044f\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044b\u044c\u044d\u044e\u20ac"; -const charset = "x-mac-ukrainian"; +const aliases = [ "x-mac-ukrainian" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertToUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testDecodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_8859-1.js b/intl/uconv/tests/unit/test_encode_8859-1.js index 511e40b12020..cd819045de87 100644 --- a/intl/uconv/tests/unit/test_encode_8859-1.js +++ b/intl/uconv/tests/unit/test_encode_8859-1.js @@ -1,19 +1,15 @@ // Tests conversion from Unicode to ISO-8859-1 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf\u00d0\u00d1\u00d2\u00d3\u00d4\u00d5\u00d6\u00d7\u00d8\u00d9\u00da\u00db\u00dc\u00dd\u00de\u00df\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed\u00ee\u00ef\u00f0\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u00f7\u00f8\u00f9\u00fa\u00fb\u00fc\u00fd\u00fe\u00ff"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "ISO-8859-1"; +const aliases = [ "ISO-8859-1", "iso-8859-1", "latin1", "iso_8859-1", + "iso8859-1", "iso-ir-100", "l1", "ibm819", "cp819", + "csisolatin1", "iso88591" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_8859-10.js b/intl/uconv/tests/unit/test_encode_8859-10.js index d27d00f55891..5ae9b3bf3654 100644 --- a/intl/uconv/tests/unit/test_encode_8859-10.js +++ b/intl/uconv/tests/unit/test_encode_8859-10.js @@ -1,19 +1,14 @@ // Tests conversion from Unicode to ISO-8859-10 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u0104\u0112\u0122\u012a\u0128\u0136\u00a7\u013b\u0110\u0160\u0166\u017d\u00ad\u016a\u014a\u00b0\u0105\u0113\u0123\u012b\u0129\u0137\u00b7\u013c\u0111\u0161\u0167\u017e\u2015\u016b\u014b\u0100\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u012e\u010c\u00c9\u0118\u00cb\u0116\u00cd\u00ce\u00cf\u00d0\u0145\u014c\u00d3\u00d4\u00d5\u00d6\u0168\u00d8\u0172\u00da\u00db\u00dc\u00dd\u00de\u00df\u0101\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u012f\u010d\u00e9\u0119\u00eb\u0117\u00ed\u00ee\u00ef\u00f0\u0146\u014d\u00f3\u00f4\u00f5\u00f6\u0169\u00f8\u0173\u00fa\u00fb\u00fc\u00fd\u00fe\u0138"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "ISO-8859-10"; +const aliases = [ "ISO-8859-10", "iso-8859-10", "iso8859-10", "latin6", + "iso-ir-157", "l6", "csisolatin6", "iso885910" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_8859-11.js b/intl/uconv/tests/unit/test_encode_8859-11.js index 3ed259af11e7..339770f30a14 100644 --- a/intl/uconv/tests/unit/test_encode_8859-11.js +++ b/intl/uconv/tests/unit/test_encode_8859-11.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to ISO-8859-11 +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u0e01\u0e02\u0e03\u0e04\u0e05\u0e06\u0e07\u0e08\u0e09\u0e0a\u0e0b\u0e0c\u0e0d\u0e0e\u0e0f\u0e10\u0e11\u0e12\u0e13\u0e14\u0e15\u0e16\u0e17\u0e18\u0e19\u0e1a\u0e1b\u0e1c\u0e1d\u0e1e\u0e1f\u0e20\u0e21\u0e22\u0e23\u0e24\u0e25\u0e26\u0e27\u0e28\u0e29\u0e2a\u0e2b\u0e2c\u0e2d\u0e2e\u0e2f\u0e30\u0e31\u0e32\u0e33\u0e34\u0e35\u0e36\u0e37\u0e38\u0e39\u0e3a\u0e3f\u0e40\u0e41\u0e42\u0e43\u0e44\u0e45\u0e46\u0e47\u0e48\u0e49\u0e4a\u0e4b\u0e4c\u0e4d\u0e4e\u0e4f\u0e50\u0e51\u0e52\u0e53\u0e54\u0e55\u0e56\u0e57\u0e58\u0e59\u0e5a\u0e5b"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "ISO-8859-11"; +const aliases = [ "ISO-8859-11", "iso-8859-11", "iso8859-11", "iso885911" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_8859-13.js b/intl/uconv/tests/unit/test_encode_8859-13.js index 4965ad77759a..ae101d5e34b4 100644 --- a/intl/uconv/tests/unit/test_encode_8859-13.js +++ b/intl/uconv/tests/unit/test_encode_8859-13.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to ISO-8859-13 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u201d\u00a2\u00a3\u00a4\u201e\u00a6\u00a7\u00d8\u00a9\u0156\u00ab\u00ac\u00ad\u00ae\u00c6\u00b0\u00b1\u00b2\u00b3\u201c\u00b5\u00b6\u00b7\u00f8\u00b9\u0157\u00bb\u00bc\u00bd\u00be\u00e6\u0104\u012e\u0100\u0106\u00c4\u00c5\u0118\u0112\u010c\u00c9\u0179\u0116\u0122\u0136\u012a\u013b\u0160\u0143\u0145\u00d3\u014c\u00d5\u00d6\u00d7\u0172\u0141\u015a\u016a\u00dc\u017b\u017d\u00df\u0105\u012f\u0101\u0107\u00e4\u00e5\u0119\u0113\u010d\u00e9\u017a\u0117\u0123\u0137\u012b\u013c\u0161\u0144\u0146\u00f3\u014d\u00f5\u00f6\u00f7\u0173\u0142\u015b\u016b\u00fc\u017c\u017e\u2019"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "ISO-8859-13"; +const aliases = [ "ISO-8859-13", "iso-8859-13", "iso8859-13", "iso885913" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_8859-14.js b/intl/uconv/tests/unit/test_encode_8859-14.js index 9d000fbe4d05..2383487f4cae 100644 --- a/intl/uconv/tests/unit/test_encode_8859-14.js +++ b/intl/uconv/tests/unit/test_encode_8859-14.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to ISO-8859-14 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u1e02\u1e03\u00a3\u010a\u010b\u1e0a\u00a7\u1e80\u00a9\u1e82\u1e0b\u1ef2\u00ad\u00ae\u0178\u1e1e\u1e1f\u0120\u0121\u1e40\u1e41\u00b6\u1e56\u1e81\u1e57\u1e83\u1e60\u1ef3\u1e84\u1e85\u1e61\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf\u0174\u00d1\u00d2\u00d3\u00d4\u00d5\u00d6\u1e6a\u00d8\u00d9\u00da\u00db\u00dc\u00dd\u0176\u00df\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed\u00ee\u00ef\u0175\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u1e6b\u00f8\u00f9\u00fa\u00fb\u00fc\u00fd\u0177\u00ff"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "ISO-8859-14"; +const aliases = [ "ISO-8859-14", "iso-8859-14", "iso8859-14", "iso885914" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_8859-15.js b/intl/uconv/tests/unit/test_encode_8859-15.js index f87133b02a41..78175181b148 100644 --- a/intl/uconv/tests/unit/test_encode_8859-15.js +++ b/intl/uconv/tests/unit/test_encode_8859-15.js @@ -1,19 +1,14 @@ // Tests conversion from Unicode to ISO-8859-15 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u00a1\u00a2\u00a3\u20ac\u00a5\u0160\u00a7\u0161\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u017d\u00b5\u00b6\u00b7\u017e\u00b9\u00ba\u00bb\u0152\u0153\u0178\u00bf\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf\u00d0\u00d1\u00d2\u00d3\u00d4\u00d5\u00d6\u00d7\u00d8\u00d9\u00da\u00db\u00dc\u00dd\u00de\u00df\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed\u00ee\u00ef\u00f0\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u00f7\u00f8\u00f9\u00fa\u00fb\u00fc\u00fd\u00fe\u00ff"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "ISO-8859-15"; +const aliases = [ "ISO-8859-15", "iso-8859-15", "iso8859-15", "iso_8859-15", + "iso885915" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_8859-2.js b/intl/uconv/tests/unit/test_encode_8859-2.js index 187b803282b6..1ded3f131e92 100644 --- a/intl/uconv/tests/unit/test_encode_8859-2.js +++ b/intl/uconv/tests/unit/test_encode_8859-2.js @@ -1,19 +1,14 @@ // Tests conversion from Unicode to ISO-8859-2 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u0104\u02d8\u0141\u00a4\u013d\u015a\u00a7\u00a8\u0160\u015e\u0164\u0179\u00ad\u017d\u017b\u00b0\u0105\u02db\u0142\u00b4\u013e\u015b\u02c7\u00b8\u0161\u015f\u0165\u017a\u02dd\u017e\u017c\u0154\u00c1\u00c2\u0102\u00c4\u0139\u0106\u00c7\u010c\u00c9\u0118\u00cb\u011a\u00cd\u00ce\u010e\u0110\u0143\u0147\u00d3\u00d4\u0150\u00d6\u00d7\u0158\u016e\u00da\u0170\u00dc\u00dd\u0162\u00df\u0155\u00e1\u00e2\u0103\u00e4\u013a\u0107\u00e7\u010d\u00e9\u0119\u00eb\u011b\u00ed\u00ee\u010f\u0111\u0144\u0148\u00f3\u00f4\u0151\u00f6\u00f7\u0159\u016f\u00fa\u0171\u00fc\u00fd\u0163\u02d9"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "ISO-8859-2"; +const aliases = [ "ISO-8859-2", "iso-8859-2", "latin2", "iso_8859-2", + "iso8859-2", "iso-ir-101", "l2", "csisolatin2", "iso88592" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_8859-3.js b/intl/uconv/tests/unit/test_encode_8859-3.js index e5e9670e62ec..afe5ffb846d3 100644 --- a/intl/uconv/tests/unit/test_encode_8859-3.js +++ b/intl/uconv/tests/unit/test_encode_8859-3.js @@ -1,19 +1,14 @@ // Tests conversion from Unicode to ISO-8859-3 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u0126\u02d8\u00a3\u00a4\u0124\u00a7\u00a8\u0130\u015e\u011e\u0134\u00ad\u017b\u00b0\u0127\u00b2\u00b3\u00b4\u00b5\u0125\u00b7\u00b8\u0131\u015f\u011f\u0135\u00bd\u017c\u00c0\u00c1\u00c2\u00c4\u010a\u0108\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf\u00d1\u00d2\u00d3\u00d4\u0120\u00d6\u00d7\u011c\u00d9\u00da\u00db\u00dc\u016c\u015c\u00df\u00e0\u00e1\u00e2\u00e4\u010b\u0109\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed\u00ee\u00ef\u00f1\u00f2\u00f3\u00f4\u0121\u00f6\u00f7\u011d\u00f9\u00fa\u00fb\u00fc\u016d\u015d\u02d9"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "ISO-8859-3"; +const aliases = [ "ISO-8859-3", "iso-8859-3", "latin3", "iso_8859-3", + "iso8859-3", "iso-ir-109", "l3", "csisolatin3", "iso88593" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_8859-4.js b/intl/uconv/tests/unit/test_encode_8859-4.js index bd31e9bb6a43..e2ebc0e35637 100644 --- a/intl/uconv/tests/unit/test_encode_8859-4.js +++ b/intl/uconv/tests/unit/test_encode_8859-4.js @@ -1,19 +1,14 @@ // Tests conversion from Unicode to ISO-8859-4 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u0104\u0138\u0156\u00a4\u0128\u013b\u00a7\u00a8\u0160\u0112\u0122\u0166\u00ad\u017d\u00af\u00b0\u0105\u02db\u0157\u00b4\u0129\u013c\u02c7\u00b8\u0161\u0113\u0123\u0167\u014a\u017e\u014b\u0100\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u012e\u010c\u00c9\u0118\u00cb\u0116\u00cd\u00ce\u012a\u0110\u0145\u014c\u0136\u00d4\u00d5\u00d6\u00d7\u00d8\u0172\u00da\u00db\u00dc\u0168\u016a\u00df\u0101\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u012f\u010d\u00e9\u0119\u00eb\u0117\u00ed\u00ee\u012b\u0111\u0146\u014d\u0137\u00f4\u00f5\u00f6\u00f7\u00f8\u0173\u00fa\u00fb\u00fc\u0169\u016b\u02d9"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "ISO-8859-4"; +const aliases = [ "ISO-8859-4", "iso-8859-4", "latin4", "iso_8859-4", + "iso8859-4", "iso-ir-110", "l4", "csisolatin4", "iso88594" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_8859-5.js b/intl/uconv/tests/unit/test_encode_8859-5.js index d64aca7ce409..14956a1472bb 100644 --- a/intl/uconv/tests/unit/test_encode_8859-5.js +++ b/intl/uconv/tests/unit/test_encode_8859-5.js @@ -1,19 +1,14 @@ // Tests conversion from Unicode to ISO-8859-5 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u0401\u0402\u0403\u0404\u0405\u0406\u0407\u0408\u0409\u040a\u040b\u040c\u00ad\u040e\u040f\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u042f\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044b\u044c\u044d\u044e\u044f\u2116\u0451\u0452\u0453\u0454\u0455\u0456\u0457\u0458\u0459\u045a\u045b\u045c\u00a7\u045e\u045f"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "ISO-8859-5"; +const aliases = [ "ISO-8859-5", "iso-8859-5", "iso_8859-5", "iso8859-5", + "iso-ir-144", "csisolatincyrillic", "iso88595" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_8859-6.js b/intl/uconv/tests/unit/test_encode_8859-6.js index bc3fa81393bd..2191df5c89e6 100644 --- a/intl/uconv/tests/unit/test_encode_8859-6.js +++ b/intl/uconv/tests/unit/test_encode_8859-6.js @@ -1,19 +1,15 @@ // Tests conversion from Unicode to ISO-8859-6 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u00a4\u060c\u00ad\u061b\u061f\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062a\u062b\u062c\u062d\u062e\u062f\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063a\u0640\u0641\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064a\u064b\u064c\u064d\u064e\u064f\u0650\u0651\u0652"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "ISO-8859-6"; +const aliases = [ "ISO-8859-6", "iso-8859-6", "iso_8859-6", "iso8859-6", + "arabic", "iso-ir-127", "ecma-114", "asmo-708", + "csisolatinarabic", "iso88596" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_8859-7.js b/intl/uconv/tests/unit/test_encode_8859-7.js index 74098a76950c..074972b06b3b 100644 --- a/intl/uconv/tests/unit/test_encode_8859-7.js +++ b/intl/uconv/tests/unit/test_encode_8859-7.js @@ -1,19 +1,15 @@ // Tests conversion from Unicode to ISO-8859-7 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u2018\u2019\u00a3\u20ac\u20af\u00a6\u00a7\u00a8\u00a9\u037a\u00ab\u00ac\u00ad\u2015\u00b0\u00b1\u00b2\u00b3\u0384\u0385\u0386\u00b7\u0388\u0389\u038a\u00bb\u038c\u00bd\u038e\u038f\u0390\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9\u03aa\u03ab\u03ac\u03ad\u03ae\u03af\u03b0\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9\u03ca\u03cb\u03cc\u03cd\u03ce"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "ISO-8859-7"; +const aliases = [ "ISO-8859-7", "iso-8859-7", "greek", "greek8", "sun_eu_greek", + "iso_8859-7", "iso8859-7", "iso-ir-126", "elot_928", + "ecma-118", "csisolatingreek", "iso88597" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_8859-8.js b/intl/uconv/tests/unit/test_encode_8859-8.js index 0b6d66f0d66b..6f08805cbeeb 100644 --- a/intl/uconv/tests/unit/test_encode_8859-8.js +++ b/intl/uconv/tests/unit/test_encode_8859-8.js @@ -1,19 +1,14 @@ // Tests conversion from Unicode to ISO-8859-8 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00d7\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00f7\u00bb\u00bc\u00bd\u00be\u2017\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5\u05d6\u05d7\u05d8\u05d9\u05da\u05db\u05dc\u05dd\u05de\u05df\u05e0\u05e1\u05e2\u05e3\u05e4\u05e5\u05e6\u05e7\u05e8\u05e9\u05ea\u200e\u200f"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "ISO-8859-8"; +const aliases = [ "ISO-8859-8", "iso-8859-8", "hebrew", "visual", "iso_8859-8", + "iso8859-8", "iso-ir-138", "csisolatinhebrew", "iso88598" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_8859-9.js b/intl/uconv/tests/unit/test_encode_8859-9.js index dfa6e49a5851..076e768d170c 100644 --- a/intl/uconv/tests/unit/test_encode_8859-9.js +++ b/intl/uconv/tests/unit/test_encode_8859-9.js @@ -1,19 +1,14 @@ // Tests conversion from Unicode to ISO-8859-9 +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf\u011e\u00d1\u00d2\u00d3\u00d4\u00d5\u00d6\u00d7\u00d8\u00d9\u00da\u00db\u00dc\u0130\u015e\u00df\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed\u00ee\u00ef\u011f\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u00f7\u00f8\u00f9\u00fa\u00fb\u00fc\u0131\u015f\u00ff"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "ISO-8859-9"; +const aliases = [ "ISO-8859-9", "iso-8859-9", "latin5", "iso_8859-9", + "iso8859-9", "iso-ir-148", "l5", "csisolatin5", "iso88599" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_CP1250.js b/intl/uconv/tests/unit/test_encode_CP1250.js index 3d9189207c2e..cc4b0a0482ce 100644 --- a/intl/uconv/tests/unit/test_encode_CP1250.js +++ b/intl/uconv/tests/unit/test_encode_CP1250.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to windows-1250 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u201a\u201e\u2026\u2020\u2021\u2030\u0160\u2039\u015a\u0164\u017d\u0179\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u2122\u0161\u203a\u015b\u0165\u017e\u017a\u00a0\u02c7\u02d8\u0141\u00a4\u0104\u00a6\u00a7\u00a8\u00a9\u015e\u00ab\u00ac\u00ad\u00ae\u017b\u00b0\u00b1\u02db\u0142\u00b4\u00b5\u00b6\u00b7\u00b8\u0105\u015f\u00bb\u013d\u02dd\u013e\u017c\u0154\u00c1\u00c2\u0102\u00c4\u0139\u0106\u00c7\u010c\u00c9\u0118\u00cb\u011a\u00cd\u00ce\u010e\u0110\u0143\u0147\u00d3\u00d4\u0150\u00d6\u00d7\u0158\u016e\u00da\u0170\u00dc\u00dd\u0162\u00df\u0155\u00e1\u00e2\u0103\u00e4\u013a\u0107\u00e7\u010d\u00e9\u0119\u00eb\u011b\u00ed\u00ee\u010f\u0111\u0144\u0148\u00f3\u00f4\u0151\u00f6\u00f7\u0159\u016f\u00fa\u0171\u00fc\u00fd\u0163\u02d9"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "windows-1250"; +const aliases = [ "windows-1250", "x-cp1250", "cp1250" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_CP1251.js b/intl/uconv/tests/unit/test_encode_CP1251.js index 8e5067f2e8ca..c8a5ac478547 100644 --- a/intl/uconv/tests/unit/test_encode_CP1251.js +++ b/intl/uconv/tests/unit/test_encode_CP1251.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to windows-1251 +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0402\u0403\u201a\u0453\u201e\u2026\u2020\u2021\u20ac\u2030\u0409\u2039\u040a\u040c\u040b\u040f\u0452\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u2122\u0459\u203a\u045a\u045c\u045b\u045f\u00a0\u040e\u045e\u0408\u00a4\u0490\u00a6\u00a7\u0401\u00a9\u0404\u00ab\u00ac\u00ad\u00ae\u0407\u00b0\u00b1\u0406\u0456\u0491\u00b5\u00b6\u00b7\u0451\u2116\u0454\u00bb\u0458\u0405\u0455\u0457\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u042f\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044b\u044c\u044d\u044e\u044f"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "windows-1251"; +const aliases = [ "windows-1251", "x-cp1251", "cp1251", "ansi-1251" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_CP1252.js b/intl/uconv/tests/unit/test_encode_CP1252.js index 219bcbefbea6..11a4b2a38a09 100644 --- a/intl/uconv/tests/unit/test_encode_CP1252.js +++ b/intl/uconv/tests/unit/test_encode_CP1252.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to windows-1252 +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u201a\u0192\u201e\u2026\u2020\u2021\u02c6\u2030\u0160\u2039\u0152\u017d\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\u0161\u203a\u0153\u017e\u0178\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf\u00d0\u00d1\u00d2\u00d3\u00d4\u00d5\u00d6\u00d7\u00d8\u00d9\u00da\u00db\u00dc\u00dd\u00de\u00df\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed\u00ee\u00ef\u00f0\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u00f7\u00f8\u00f9\u00fa\u00fb\u00fc\u00fd\u00fe\u00ff"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "windows-1252"; +const aliases = [ "windows-1252", "x-cp1252", "cp1252" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_CP1253.js b/intl/uconv/tests/unit/test_encode_CP1253.js index 0100eea0a899..5ac171ddc13a 100644 --- a/intl/uconv/tests/unit/test_encode_CP1253.js +++ b/intl/uconv/tests/unit/test_encode_CP1253.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to windows-1253 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u201a\u0192\u201e\u2026\u2020\u2021\u2030\u2039\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u2122\u203a\u00a0\u0385\u0386\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00ab\u00ac\u00ad\u00ae\u2015\u00b0\u00b1\u00b2\u00b3\u0384\u00b5\u00b6\u00b7\u0388\u0389\u038a\u00bb\u038c\u00bd\u038e\u038f\u0390\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9\u03aa\u03ab\u03ac\u03ad\u03ae\u03af\u03b0\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9\u03ca\u03cb\u03cc\u03cd\u03ce"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "windows-1253"; +const aliases = [ "windows-1253", "x-cp1253", "cp1253" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_CP1254.js b/intl/uconv/tests/unit/test_encode_CP1254.js index 8e3d34532d3c..5ddd30b4c137 100644 --- a/intl/uconv/tests/unit/test_encode_CP1254.js +++ b/intl/uconv/tests/unit/test_encode_CP1254.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to windows-1254 +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u201a\u0192\u201e\u2026\u2020\u2021\u02c6\u2030\u0160\u2039\u0152\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\u0161\u203a\u0153\u0178\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf\u011e\u00d1\u00d2\u00d3\u00d4\u00d5\u00d6\u00d7\u00d8\u00d9\u00da\u00db\u00dc\u0130\u015e\u00df\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed\u00ee\u00ef\u011f\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u00f7\u00f8\u00f9\u00fa\u00fb\u00fc\u0131\u015f\u00ff"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "windows-1254"; +const aliases = [ "windows-1254", "x-cp1254", "cp1254" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_CP1255.js b/intl/uconv/tests/unit/test_encode_CP1255.js index 8eb1af2baac5..77b6ae5a571a 100644 --- a/intl/uconv/tests/unit/test_encode_CP1255.js +++ b/intl/uconv/tests/unit/test_encode_CP1255.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to windows-1255 +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u201a\u0192\u201e\u2026\u2020\u2021\u02c6\u2030\u2039\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\u203a\u00a0\u00a1\u00a2\u00a3\u20aa\u00a5\u00a6\u00a7\u00a8\u00a9\u00d7\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00f7\u00bb\u00bc\u00bd\u00be\u00bf\u05b0\u05b1\u05b2\u05b3\u05b4\u05b5\u05b6\u05b7\u05b8\u05b9\u05bb\u05bc\u05bd\u05be\u05bf\u05c0\u05c1\u05c2\u05c3\u05f0\u05f1\u05f2\u05f3\u05f4\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5\u05d6\u05d7\u05d8\u05d9\u05da\u05db\u05dc\u05dd\u05de\u05df\u05e0\u05e1\u05e2\u05e3\u05e4\u05e5\u05e6\u05e7\u05e8\u05e9\u05ea\u200e\u200f"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "windows-1255"; +const aliases = [ "windows-1255", "x-cp1255", "cp1255" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_CP1256.js b/intl/uconv/tests/unit/test_encode_CP1256.js index acdaf0bd6445..ed1f90b2fe1b 100644 --- a/intl/uconv/tests/unit/test_encode_CP1256.js +++ b/intl/uconv/tests/unit/test_encode_CP1256.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to windows-1256 +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u067e\u201a\u0192\u201e\u2026\u2020\u2021\u02c6\u2030\u0679\u2039\u0152\u0686\u0698\u0688\u06af\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u06a9\u2122\u0691\u203a\u0153\u200c\u200d\u06ba\u00a0\u060c\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u06be\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u061b\u00bb\u00bc\u00bd\u00be\u061f\u06c1\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062a\u062b\u062c\u062d\u062e\u062f\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u00d7\u0637\u0638\u0639\u063a\u0640\u0641\u0642\u0643\u00e0\u0644\u00e2\u0645\u0646\u0647\u0648\u00e7\u00e8\u00e9\u00ea\u00eb\u0649\u064a\u00ee\u00ef\u064b\u064c\u064d\u064e\u00f4\u064f\u0650\u00f7\u0651\u00f9\u0652\u00fb\u00fc\u200e\u200f\u06d2"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "windows-1256"; +const aliases = [ "windows-1256", "x-cp1256", "cp1256" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_CP1257.js b/intl/uconv/tests/unit/test_encode_CP1257.js index 76c2047e7181..6d91736754d0 100644 --- a/intl/uconv/tests/unit/test_encode_CP1257.js +++ b/intl/uconv/tests/unit/test_encode_CP1257.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to windows-1257 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u201a\u201e\u2026\u2020\u2021\u2030\u2039\u00a8\u02c7\u00b8\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u2122\u203a\u00af\u02db\u00a0\u00a2\u00a3\u00a4\u00a6\u00a7\u00d8\u00a9\u0156\u00ab\u00ac\u00ad\u00ae\u00c6\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00f8\u00b9\u0157\u00bb\u00bc\u00bd\u00be\u00e6\u0104\u012e\u0100\u0106\u00c4\u00c5\u0118\u0112\u010c\u00c9\u0179\u0116\u0122\u0136\u012a\u013b\u0160\u0143\u0145\u00d3\u014c\u00d5\u00d6\u00d7\u0172\u0141\u015a\u016a\u00dc\u017b\u017d\u00df\u0105\u012f\u0101\u0107\u00e4\u00e5\u0119\u0113\u010d\u00e9\u017a\u0117\u0123\u0137\u012b\u013c\u0161\u0144\u0146\u00f3\u014d\u00f5\u00f6\u00f7\u0173\u0142\u015b\u016b\u00fc\u017c\u017e\u02d9"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "windows-1257"; +const aliases = [ "windows-1257", "x-cp1257", "cp1257" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_CP1258.js b/intl/uconv/tests/unit/test_encode_CP1258.js index c69b378aba9c..c9bfdf90ec36 100644 --- a/intl/uconv/tests/unit/test_encode_CP1258.js +++ b/intl/uconv/tests/unit/test_encode_CP1258.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to windows-1258 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u201a\u0192\u201e\u2026\u2020\u2021\u02c6\u2030\u2039\u0152\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\u203a\u0153\u0178\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u0102\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u0300\u00cd\u00ce\u00cf\u0110\u00d1\u0309\u00d3\u00d4\u01a0\u00d6\u00d7\u00d8\u00d9\u00da\u00db\u00dc\u01af\u0303\u00df\u00e0\u00e1\u00e2\u0103\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u0301\u00ed\u00ee\u00ef\u0111\u00f1\u0323\u00f3\u00f4\u01a1\u00f6\u00f7\u00f8\u00f9\u00fa\u00fb\u00fc\u01b0\u20ab\u00ff"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "windows-1258"; +const aliases = [ "windows-1258", "x-cp1258", "cp1258" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_CP850.js b/intl/uconv/tests/unit/test_encode_CP850.js index 7dd8a355ca7d..62ff57c0362b 100644 --- a/intl/uconv/tests/unit/test_encode_CP850.js +++ b/intl/uconv/tests/unit/test_encode_CP850.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to IBM850 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u00ec\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u00ff\u00d6\u00dc\u00f8\u00a3\u00d8\u00d7\u0192\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u00aa\u00ba\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u00c1\u00c2\u00c0\u00a9\u2563\u2551\u2557\u255d\u00a2\u00a5\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u00e3\u00c3\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u00a4\u00f0\u00d0\u00ca\u00cb\u00c8\u20ac\u00cd\u00ce\u00cf\u2518\u250c\u2588\u2584\u00a6\u00cc\u2580\u00d3\u00df\u00d4\u00d2\u00f5\u00d5\u00b5\u00fe\u00de\u00da\u00db\u00d9\u00fd\u00dd\u00af\u00b4\u00ad\u00b1\u2017\u00be\u00b6\u00a7\u00f7\u00b8\u00b0\u00a8\u00b7\u00b9\u00b3\u00b2\u25a0\u00a0"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "IBM850"; +const aliases = [ "IBM850", "ibm850", "cp850", "850", "csibm850" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_CP852.js b/intl/uconv/tests/unit/test_encode_CP852.js index 5374b8c180f7..54ac462a6fca 100644 --- a/intl/uconv/tests/unit/test_encode_CP852.js +++ b/intl/uconv/tests/unit/test_encode_CP852.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to IBM852 +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c7\u00fc\u00e9\u00e2\u00e4\u016f\u0107\u00e7\u0142\u00eb\u0150\u0151\u00ee\u0179\u00c4\u0106\u00c9\u0139\u013a\u00f4\u00f6\u013d\u013e\u015a\u015b\u00d6\u00dc\u0164\u0165\u0141\u00d7\u010d\u00e1\u00ed\u00f3\u00fa\u0104\u0105\u017d\u017e\u0118\u0119\u20ac\u017a\u010c\u015f\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u00c1\u00c2\u011a\u015e\u2563\u2551\u2557\u255d\u017b\u017c\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u0102\u0103\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u00a4\u0111\u0110\u010e\u00cb\u010f\u0147\u00cd\u00ce\u011b\u2518\u250c\u2588\u2584\u0162\u016e\u2580\u00d3\u00df\u00d4\u0143\u0144\u0148\u0160\u0161\u0154\u00da\u0155\u0170\u00fd\u00dd\u0163\u00b4\u00ad\u02dd\u02db\u02c7\u02d8\u00a7\u00f7\u00b8\u00b0\u00a8\u02d9\u0171\u0158\u0159\u25a0\u00a0"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "IBM852"; +const aliases = [ "IBM852", "ibm852", "cp852", "852", "csibm852" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_CP855.js b/intl/uconv/tests/unit/test_encode_CP855.js index 00dd7594afb0..707070e4d8e8 100644 --- a/intl/uconv/tests/unit/test_encode_CP855.js +++ b/intl/uconv/tests/unit/test_encode_CP855.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to IBM855 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0452\u0402\u0453\u0403\u0451\u0401\u0454\u0404\u0455\u0405\u0456\u0406\u0457\u0407\u0458\u0408\u0459\u0409\u045a\u040a\u045b\u040b\u045c\u040c\u045e\u040e\u045f\u040f\u044e\u042e\u044a\u042a\u0430\u0410\u0431\u0411\u0446\u0426\u0434\u0414\u0435\u0415\u0444\u0424\u0433\u0413\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u0445\u0425\u0438\u0418\u2563\u2551\u2557\u255d\u0439\u0419\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u043a\u041a\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u00a4\u043b\u041b\u043c\u041c\u043d\u041d\u043e\u041e\u043f\u2518\u250c\u2588\u2584\u041f\u044f\u2580\u042f\u0440\u0420\u0441\u0421\u0442\u0422\u0443\u0423\u0436\u0416\u0432\u0412\u044c\u042c\u2116\u00ad\u044b\u042b\u0437\u0417\u0448\u0428\u044d\u042d\u0449\u0429\u0447\u0427\u00a7\u25a0\u00a0"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "IBM855"; +const aliases = [ "IBM855", "ibm855", "cp855", "855", "csibm855" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_CP857.js b/intl/uconv/tests/unit/test_encode_CP857.js index bb6fcabd335c..f73472a9605c 100644 --- a/intl/uconv/tests/unit/test_encode_CP857.js +++ b/intl/uconv/tests/unit/test_encode_CP857.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to IBM857 +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c7\u00fc\u00e9\u00e2\u00e4\u00e0\u00e5\u00e7\u00ea\u00eb\u00e8\u00ef\u00ee\u0131\u00c4\u00c5\u00c9\u00e6\u00c6\u00f4\u00f6\u00f2\u00fb\u00f9\u0130\u00d6\u00dc\u00f8\u00a3\u00d8\u015e\u015f\u00e1\u00ed\u00f3\u00fa\u00f1\u00d1\u011e\u011f\u00bf\u00ae\u00ac\u00bd\u00bc\u00a1\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u00c1\u00c2\u00c0\u00a9\u2563\u2551\u2557\u255d\u00a2\u00a5\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u00e3\u00c3\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u00a4\u00ba\u00aa\u00ca\u00cb\u00c8\u20ac\u00cd\u00ce\u00cf\u2518\u250c\u2588\u2584\u00a6\u00cc\u2580\u00d3\u00df\u00d4\u00d2\u00f5\u00d5\u00b5\u00d7\u00da\u00db\u00d9\u00ec\u00ff\u00af\u00b4\u00ad\u00b1\u00be\u00b6\u00a7\u00f7\u00b8\u00b0\u00a8\u00b7\u00b9\u00b3\u00b2\u25a0\u00a0"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "IBM857"; +const aliases = [ "IBM857", "ibm857", "cp857", "857", "csibm857" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_CP862.js b/intl/uconv/tests/unit/test_encode_CP862.js index d2e758295269..cd9965eb7b94 100644 --- a/intl/uconv/tests/unit/test_encode_CP862.js +++ b/intl/uconv/tests/unit/test_encode_CP862.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to IBM862 + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5\u05d6\u05d7\u05d8\u05d9\u05da\u05db\u05dc\u05dd\u05de\u05df\u05e0\u05e1\u05e2\u05e3\u05e4\u05e5\u05e6\u05e7\u05e8\u05e9\u05ea\u00a2\u00a3\u00a5\u20aa\u200e\u200f\u202a\u202b\u202d\u202c\u202e\u2310\u00ac\u00bd\u00bc\u20ac\u00ab\u00bb\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u03b1\u00df\u0393\u03c0\u03a3\u03c3\u00b5\u03c4\u03a6\u0398\u03a9\u03b4\u221e\u03c6\u03b5\u2229\u2261\u00b1\u2265\u2264\u2320\u2321\u00f7\u2248\u00b0\u2219\u00b7\u221a\u207f\u00b2\u25a0\u00a0"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "IBM862"; +const aliases = [ "IBM862", "ibm862", "cp862", "862", "csibm862" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_CP864.js b/intl/uconv/tests/unit/test_encode_CP864.js index a269e04e29ad..8c8fcfc12cb8 100644 --- a/intl/uconv/tests/unit/test_encode_CP864.js +++ b/intl/uconv/tests/unit/test_encode_CP864.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to IBM864 +load('CharsetConversionTests.js'); + const inString = " !\"#$\u066a&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00b0\u00b7\u2219\u221a\u2592\u2500\u2502\u253c\u2524\u252c\u251c\u2534\u2510\u250c\u2514\u2518\u03b2\u221e\u03c6\u00b1\u00bd\u00bc\u2248\u00ab\u00bb\ufef7\ufef8\ufefb\ufefc\u00a0\u00ad\ufe82\u00a3\u00a4\ufe84\u20ac\ufe8e\ufe8f\ufe95\ufe99\u060c\ufe9d\ufea1\ufea5\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\ufed1\u061b\ufeb1\ufeb5\ufeb9\u061f\u00a2\ufe80\ufe81\ufe83\ufe85\ufeca\ufe8b\ufe8d\ufe91\ufe93\ufe97\ufe9b\ufe9f\ufea3\ufea7\ufea9\ufeab\ufead\ufeaf\ufeb3\ufeb7\ufebb\ufebf\ufec1\ufec5\ufecb\ufecf\u00a6\u00ac\u00f7\u00d7\ufec9\u0640\ufed3\ufed7\ufedb\ufedf\ufee3\ufee7\ufeeb\ufeed\ufeef\ufef3\ufebd\ufecc\ufece\ufecd\ufee1\ufe7d\u0651\ufee5\ufee9\ufeec\ufef0\ufef2\ufed0\ufed5\ufef5\ufef6\ufedd\ufed9\ufef1\u25a0"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "IBM864"; +const aliases = [ "IBM864", "ibm864", "cp864", "864", "csibm864", "ibm-864" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_CP874.js b/intl/uconv/tests/unit/test_encode_CP874.js index ab12d1484a59..ba475fdf0d77 100644 --- a/intl/uconv/tests/unit/test_encode_CP874.js +++ b/intl/uconv/tests/unit/test_encode_CP874.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to windows-874 +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u2026\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u00a0\u0e01\u0e02\u0e03\u0e04\u0e05\u0e06\u0e07\u0e08\u0e09\u0e0a\u0e0b\u0e0c\u0e0d\u0e0e\u0e0f\u0e10\u0e11\u0e12\u0e13\u0e14\u0e15\u0e16\u0e17\u0e18\u0e19\u0e1a\u0e1b\u0e1c\u0e1d\u0e1e\u0e1f\u0e20\u0e21\u0e22\u0e23\u0e24\u0e25\u0e26\u0e27\u0e28\u0e29\u0e2a\u0e2b\u0e2c\u0e2d\u0e2e\u0e2f\u0e30\u0e31\u0e32\u0e33\u0e34\u0e35\u0e36\u0e37\u0e38\u0e39\u0e3a\u0e3f\u0e40\u0e41\u0e42\u0e43\u0e44\u0e45\u0e46\u0e47\u0e48\u0e49\u0e4a\u0e4b\u0e4c\u0e4d\u0e4e\u0e4f\u0e50\u0e51\u0e52\u0e53\u0e54\u0e55\u0e56\u0e57\u0e58\u0e59\u0e5a\u0e5b"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "windows-874"; +const aliases = [ "windows-874", "ibm874" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_armscii.js b/intl/uconv/tests/unit/test_encode_armscii.js index 54e109ed8ede..dfc7742cbcd4 100644 --- a/intl/uconv/tests/unit/test_encode_armscii.js +++ b/intl/uconv/tests/unit/test_encode_armscii.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to armscii-8 +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0587\u0589\u00bb\u00ab\u2014\u055d\u058a\u2026\u055c\u055b\u055e\u0531\u0561\u0532\u0562\u0533\u0563\u0534\u0564\u0535\u0565\u0536\u0566\u0537\u0567\u0538\u0568\u0539\u0569\u053a\u056a\u053b\u056b\u053c\u056c\u053d\u056d\u053e\u056e\u053f\u056f\u0540\u0570\u0541\u0571\u0542\u0572\u0543\u0573\u0544\u0574\u0545\u0575\u0546\u0576\u0547\u0577\u0548\u0578\u0549\u0579\u054a\u057a\u054b\u057b\u054c\u057c\u054d\u057d\u054e\u057e\u054f\u057f\u0550\u0580\u0551\u0581\u0552\u0582\u0553\u0583\u0554\u0584\u0555\u0585\u0556\u0586\u055a"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "armscii-8"; +const aliases = ["armscii-8"]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_geostd8.js b/intl/uconv/tests/unit/test_encode_geostd8.js index 2fa6eeb4a178..f61f1fadd416 100644 --- a/intl/uconv/tests/unit/test_encode_geostd8.js +++ b/intl/uconv/tests/unit/test_encode_geostd8.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to geostd8 +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u20ac\u201a\u201e\u2026\u2020\u2021\u2030\u2039\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u203a\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb\u00bc\u00bd\u00be\u00bf\u10d0\u10d1\u10d2\u10d3\u10d4\u10d5\u10d6\u10f1\u10d7\u10d8\u10d9\u10da\u10db\u10dc\u10f2\u10dd\u10de\u10df\u10e0\u10e1\u10e2\u10f3\u10e3\u10e4\u10e5\u10e6\u10e7\u10e8\u10e9\u10ea\u10eb\u10ec\u10ed\u10ee\u10f4\u10ef\u10f0\u10f5\u2116"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "geostd8"; +const aliases = ["GEOSTD8"]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_tcvn5712.js b/intl/uconv/tests/unit/test_encode_tcvn5712.js index 8db88a8fcdf2..78e2a4b58271 100644 --- a/intl/uconv/tests/unit/test_encode_tcvn5712.js +++ b/intl/uconv/tests/unit/test_encode_tcvn5712.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to x-viet-tcvn5712 + +load('CharsetConversionTests.js'); const inString = "\u00da\u1ee4\u1eea\u1eec\u1eee\u1ee8\u1ef0\u1ef2\u1ef6\u1ef8\u00dd\u1ef4 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c0\u1ea2\u00c3\u00c1\u1ea0\u1eb6\u1eac\u00c8\u1eba\u1ebc\u00c9\u1eb8\u1ec6\u00cc\u1ec8\u0128\u00cd\u1eca\u00d2\u1ece\u00d5\u00d3\u1ecc\u1ed8\u1edc\u1ede\u1ee0\u1eda\u1ee2\u00d9\u1ee6\u0168\u00a0\u0102\u00c2\u00ca\u00d4\u01a0\u01af\u0110\u0103\u00e2\u00ea\u00f4\u01a1\u01b0\u0111\u1eb0\u0300\u0309\u0303\u0301\u0323\u00e0\u1ea3\u00e3\u00e1\u1ea1\u1eb2\u1eb1\u1eb3\u1eb5\u1eaf\u1eb4\u1eae\u1ea6\u1ea8\u1eaa\u1ea4\u1ec0\u1eb7\u1ea7\u1ea9\u1eab\u1ea5\u1ead\u00e8\u1ec2\u1ebb\u1ebd\u00e9\u1eb9\u1ec1\u1ec3\u1ec5\u1ebf\u1ec7\u00ec\u1ec9\u1ec4\u1ebe\u1ed2\u0129\u00ed\u1ecb\u00f2\u1ed4\u1ecf\u00f5\u00f3\u1ecd\u1ed3\u1ed5\u1ed7\u1ed1\u1ed9\u1edd\u1edf\u1ee1\u1edb\u1ee3\u00f9\u1ed6\u1ee7\u0169\u00fa\u1ee5\u1eeb\u1eed\u1eef\u1ee9\u1ef1\u1ef3\u1ef7\u1ef9\u00fd\u1ef5\u1ed0"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "x-viet-tcvn5712"; +const aliases = [ "x-viet-tcvn5712" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_viscii.js b/intl/uconv/tests/unit/test_encode_viscii.js index 43f5e0da07ed..97b5825f128d 100644 --- a/intl/uconv/tests/unit/test_encode_viscii.js +++ b/intl/uconv/tests/unit/test_encode_viscii.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to viscii + +load('CharsetConversionTests.js'); const inString = "\u1eb2\u1eb4\u1eaa\u1ef6\u1ef8\u1ef4 !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u1ea0\u1eae\u1eb0\u1eb6\u1ea4\u1ea6\u1ea8\u1eac\u1ebc\u1eb8\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1ee2\u1eda\u1edc\u1ede\u1eca\u1ece\u1ecc\u1ec8\u1ee6\u0168\u1ee4\u1ef2\u00d5\u1eaf\u1eb1\u1eb7\u1ea5\u1ea7\u1ea9\u1ead\u1ebd\u1eb9\u1ebf\u1ec1\u1ec3\u1ec5\u1ec7\u1ed1\u1ed3\u1ed5\u1ed7\u1ee0\u01a0\u1ed9\u1edd\u1edf\u1ecb\u1ef0\u1ee8\u1eea\u1eec\u01a1\u1edb\u01af\u00c0\u00c1\u00c2\u00c3\u1ea2\u0102\u1eb3\u1eb5\u00c8\u00c9\u00ca\u1eba\u00cc\u00cd\u0128\u1ef3\u0110\u1ee9\u00d2\u00d3\u00d4\u1ea1\u1ef7\u1eeb\u1eed\u00d9\u00da\u1ef9\u1ef5\u00dd\u1ee1\u01b0\u00e0\u00e1\u00e2\u00e3\u1ea3\u0103\u1eef\u1eab\u00e8\u00e9\u00ea\u1ebb\u00ec\u00ed\u0129\u1ec9\u0111\u1ef1\u00f2\u00f3\u00f4\u00f5\u1ecf\u1ecd\u1ee5\u00f9\u00fa\u0169\u1ee7\u00fd\u1ee3\u1eee"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "viscii"; +const aliases = [ "VISCII", "viscii", "csviscii" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_vps.js b/intl/uconv/tests/unit/test_encode_vps.js index 7d84ea677452..8f024b10dde4 100644 --- a/intl/uconv/tests/unit/test_encode_vps.js +++ b/intl/uconv/tests/unit/test_encode_vps.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to x-viet-vps + +load('CharsetConversionTests.js'); const inString = "\u1ea0\u1eac\u1eb6\u1eb8\u1ec6\u1eca\u1ecc\u1ed8\u1ee2\u1ee4\u1ef0\u1ef4\u1eaa\u1eee !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c0\u1ea2\u00c3\u1ea4\u1ea6\u1ea8\u1ecd\u1ed7\u0102\u1ebf\u1ec1\u1ec3\u1ec7\u1eae\u1eb0\u1eb2\u1ebe\u2018\u2019\u1ec0\u1ec2\u1ec4\u1ed0\u1ed2\u1ed4\u1ed6\u00fd\u1ef7\u1ef5\u1eda\u1edc\u1ede\u00a0\u1eaf\u1eb1\u1eb3\u1eb5\u1eb7\u1ee0\u1edb\u00d9\u1edd\u1edf\u1ee1\u0168\u1ee8\u1ee3\u1eea\u1ed5\u1eec\u1ef2\u1ef8\u00cd\u00cc\u1ed9\u1ec8\u0128\u00d3\u1eed\u1eef\u00d2\u1ece\u00d5\u1ef1\u1ea7\u00c1\u00c2\u1ea5\u1ea9\u1eab\u1ead\u0111\u1ebb\u00c9\u00ca\u1eb9\u1ec9\u1ec5\u1ecb\u1ef9\u01af\u1ee6\u1ed3\u1ed1\u00d4\u1ecf\u01a1\u00c8\u1eeb\u1ee9\u00da\u0169\u01b0\u00dd\u1eba\u00df\u00e0\u00e1\u00e2\u00e3\u1ea3\u1ea1\u0103\u00e7\u00e8\u00e9\u00ea\u1ebd\u00ec\u00ed\u00ee\u0129\u1eb4\u0110\u00f2\u00f3\u00f4\u00f5\u00f6\u01a0\u1ee5\u00f9\u00fa\u1ee7\u00fc\u1ef6\u1ebc\u1ef3"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "x-viet-vps"; +const aliases = [ "x-viet-vps" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_x_mac_arabic.js b/intl/uconv/tests/unit/test_encode_x_mac_arabic.js index 517963315e4e..ecc78c1d74be 100644 --- a/intl/uconv/tests/unit/test_encode_x_mac_arabic.js +++ b/intl/uconv/tests/unit/test_encode_x_mac_arabic.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to x-mac-arabic + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\u00a0\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u06ba\u00ab\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u2026\u00ee\u00ef\u00f1\u00f3\u00bb\u00f4\u00f6\u00f7\u00fa\u00f9\u00fb\u00fc !\"#$\u066a&'()*+\u060c-./\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669:\u061b<=>\u061f\u274a\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062a\u062b\u062c\u062d\u062e\u062f\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063a[\\]^_\u0640\u0641\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064a\u064b\u064c\u064d\u064e\u064f\u0650\u0651\u0652\u067e\u0679\u0686\u06d5\u06a4\u06af\u0688\u0691{|}\u0698\u06d2"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !\"#$&'()*+-./:<=>[\\]^_{|}"; -const charset = "x-mac-arabic"; +const aliases = [ "x-mac-arabic" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_x_mac_ce.js b/intl/uconv/tests/unit/test_encode_x_mac_ce.js index 2cb46889ed0a..8765e6aecdaa 100644 --- a/intl/uconv/tests/unit/test_encode_x_mac_ce.js +++ b/intl/uconv/tests/unit/test_encode_x_mac_ce.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to x-mac-ce +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\u0100\u0101\u00c9\u0104\u00d6\u00dc\u00e1\u0105\u010c\u00e4\u010d\u0106\u0107\u00e9\u0179\u017a\u010e\u00ed\u010f\u0112\u0113\u0116\u00f3\u0117\u00f4\u00f6\u00f5\u00fa\u011a\u011b\u00fc\u2020\u00b0\u0118\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u0119\u00a8\u2260\u0123\u012e\u012f\u012a\u2264\u2265\u012b\u0136\u2202\u2211\u0142\u013b\u013c\u013d\u013e\u0139\u013a\u0145\u0146\u0143\u00ac\u221a\u0144\u0147\u2206\u00ab\u00bb\u2026\u00a0\u0148\u0150\u00d5\u0151\u014c\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u014d\u0154\u0155\u0158\u2039\u203a\u0159\u0156\u0157\u0160\u201a\u201e\u0161\u015a\u015b\u00c1\u0164\u0165\u00cd\u017d\u017e\u016a\u00d3\u00d4\u016b\u016e\u00da\u016f\u0170\u0171\u0172\u0173\u00dd\u00fd\u0137\u017b\u0141\u017c\u0122\u02c7"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "x-mac-ce"; +const aliases = [ "x-mac-ce" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_x_mac_croatian.js b/intl/uconv/tests/unit/test_encode_x_mac_croatian.js index 33e8dabaeb6f..4b4c8a6f975c 100644 --- a/intl/uconv/tests/unit/test_encode_x_mac_croatian.js +++ b/intl/uconv/tests/unit/test_encode_x_mac_croatian.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to x-mac-croatian +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u0160\u2122\u00b4\u00a8\u2260\u017d\u00d8\u221e\u00b1\u2264\u2265\u2206\u00b5\u2202\u2211\u220f\u0161\u222b\u00aa\u00ba\u03a9\u017e\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u0106\u00ab\u010c\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u0110\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\uf8ff\u00a9\u2044\u20ac\u2039\u203a\u00c6\u00bb\u2013\u00b7\u201a\u201e\u2030\u00c2\u0107\u00c1\u010d\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\u0111\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u03c0\u00cb\u02da\u00b8\u00ca\u00e6\u02c7"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "x-mac-croatian"; +const aliases = [ "x-mac-croatian" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_x_mac_cyrillic.js b/intl/uconv/tests/unit/test_encode_x_mac_cyrillic.js index 0e63b11e4507..110cf4f89ee3 100644 --- a/intl/uconv/tests/unit/test_encode_x_mac_cyrillic.js +++ b/intl/uconv/tests/unit/test_encode_x_mac_cyrillic.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to x-mac-cyrillic +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u042f\u2020\u00b0\u0490\u00a3\u00a7\u2022\u00b6\u0406\u00ae\u00a9\u2122\u0402\u0452\u2260\u0403\u0453\u221e\u00b1\u2264\u2265\u0456\u00b5\u0491\u0408\u0404\u0454\u0407\u0457\u0409\u0459\u040a\u045a\u0458\u0405\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u040b\u045b\u040c\u045c\u0455\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u201e\u040e\u045e\u040f\u045f\u2116\u0401\u0451\u044f\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044b\u044c\u044d\u044e\u20ac"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "x-mac-cyrillic"; +const aliases = [ "x-mac-cyrillic" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_x_mac_devanagari.js b/intl/uconv/tests/unit/test_encode_x_mac_devanagari.js index eb775d8cfc85..e3ba907a08d2 100644 --- a/intl/uconv/tests/unit/test_encode_x_mac_devanagari.js +++ b/intl/uconv/tests/unit/test_encode_x_mac_devanagari.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to x-mac-devanagari + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00d7\u2212\u2013\u2014\u2018\u2019\u2026\u2022\u00a9\u00ae\u2122\u0965\u0970\u0901\u0902\u0903\u0905\u0906\u0907\u0908\u0909\u090a\u090b\u090e\u090f\u0910\u090d\u0912\u0913\u0914\u0911\u0915\u0916\u0917\u0918\u0919\u091a\u091b\u091c\u091d\u091e\u091f\u0920\u0921\u0922\u0923\u0924\u0925\u0926\u0927\u0928\u0929\u092a\u092b\u092c\u092d\u092e\u092f\u095f\u0930\u0931\u0932\u0933\u0934\u0935\u0936\u0937\u0938\u0939\u200e\u093e\u093f\u0940\u0941\u0942\u0943\u0946\u0947\u0948\u0945\u094a\u094b\u094c\u0949\u094d\u093c\u0964\u0966\u0967\u0968\u0969\u096a\u096b\u096c\u096d\u096e\u096f"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "x-mac-devanagari"; +const aliases = [ "x-mac-devanagari" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_x_mac_farsi.js b/intl/uconv/tests/unit/test_encode_x_mac_farsi.js index eb3f97c591ae..801a3aa5178a 100644 --- a/intl/uconv/tests/unit/test_encode_x_mac_farsi.js +++ b/intl/uconv/tests/unit/test_encode_x_mac_farsi.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to x-mac-farsi + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\u00a0\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u06ba\u00ab\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u2026\u00ee\u00ef\u00f1\u00f3\u00bb\u00f4\u00f6\u00f7\u00fa\u00f9\u00fb\u00fc !\"#$\u066a&'()*+\u060c-./\u06f0\u06f1\u06f2\u06f3\u06f4\u06f5\u06f6\u06f7\u06f8\u06f9:\u061b<=>\u061f\u274a\u0621\u0622\u0623\u0624\u0625\u0626\u0627\u0628\u0629\u062a\u062b\u062c\u062d\u062e\u062f\u0630\u0631\u0632\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063a[\\]^_\u0640\u0641\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064a\u064b\u064c\u064d\u064e\u064f\u0650\u0651\u0652\u067e\u0679\u0686\u06d5\u06a4\u06af\u0688\u0691{|}\u0698\u06d2"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !\"#$&'()*+-./:<=>[\\]^_{|}"; -const charset = "x-mac-farsi"; +const aliases = [ "x-mac-farsi" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_x_mac_greek.js b/intl/uconv/tests/unit/test_encode_x_mac_greek.js index ff164168ca48..c9eb785d5beb 100644 --- a/intl/uconv/tests/unit/test_encode_x_mac_greek.js +++ b/intl/uconv/tests/unit/test_encode_x_mac_greek.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to x-mac-greek +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\u00b9\u00b2\u00c9\u00b3\u00d6\u00dc\u0385\u00e0\u00e2\u00e4\u0384\u00a8\u00e7\u00e9\u00e8\u00ea\u00eb\u00a3\u2122\u00ee\u00ef\u2022\u00bd\u2030\u00f4\u00f6\u00a6\u20ac\u00f9\u00fb\u00fc\u2020\u0393\u0394\u0398\u039b\u039e\u03a0\u00df\u00ae\u00a9\u03a3\u03aa\u00a7\u2260\u00b0\u00b7\u0391\u00b1\u2264\u2265\u00a5\u0392\u0395\u0396\u0397\u0399\u039a\u039c\u03a6\u03ab\u03a8\u03a9\u03ac\u039d\u00ac\u039f\u03a1\u2248\u03a4\u00ab\u00bb\u2026\u00a0\u03a5\u03a7\u0386\u0388\u0153\u2013\u2015\u201c\u201d\u2018\u2019\u00f7\u0389\u038a\u038c\u038e\u03ad\u03ae\u03af\u03cc\u038f\u03cd\u03b1\u03b2\u03c8\u03b4\u03b5\u03c6\u03b3\u03b7\u03b9\u03be\u03ba\u03bb\u03bc\u03bd\u03bf\u03c0\u03ce\u03c1\u03c3\u03c4\u03b8\u03c9\u03c2\u03c7\u03c5\u03b6\u03ca\u03cb\u0390\u03b0\u00ad"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "x-mac-greek"; +const aliases = [ "x-mac-greek" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_x_mac_gujarati.js b/intl/uconv/tests/unit/test_encode_x_mac_gujarati.js index ebd5b6418a35..9dec6abf608a 100644 --- a/intl/uconv/tests/unit/test_encode_x_mac_gujarati.js +++ b/intl/uconv/tests/unit/test_encode_x_mac_gujarati.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to x-mac-gujarati + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00d7\u2212\u2013\u2014\u2018\u2019\u2026\u2022\u00a9\u00ae\u2122\u0965\u0a81\u0a82\u0a83\u0a85\u0a86\u0a87\u0a88\u0a89\u0a8a\u0a8b\u0a8f\u0a90\u0a8d\u0a93\u0a94\u0a91\u0a95\u0a96\u0a97\u0a98\u0a99\u0a9a\u0a9b\u0a9c\u0a9d\u0a9e\u0a9f\u0aa0\u0aa1\u0aa2\u0aa3\u0aa4\u0aa5\u0aa6\u0aa7\u0aa8\u0aaa\u0aab\u0aac\u0aad\u0aae\u0aaf\u0ab0\u0ab2\u0ab3\u0ab5\u0ab6\u0ab7\u0ab8\u0ab9\u200e\u0abe\u0abf\u0ac0\u0ac1\u0ac2\u0ac3\u0ac7\u0ac8\u0ac5\u0acb\u0acc\u0ac9\u0acd\u0abc\u0964\u0ae6\u0ae7\u0ae8\u0ae9\u0aea\u0aeb\u0aec\u0aed\u0aee\u0aef"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "x-mac-gujarati"; +const aliases = [ "x-mac-gujarati" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_x_mac_gurmukhi.js b/intl/uconv/tests/unit/test_encode_x_mac_gurmukhi.js index 9bf51afe803b..42c01d06d851 100644 --- a/intl/uconv/tests/unit/test_encode_x_mac_gurmukhi.js +++ b/intl/uconv/tests/unit/test_encode_x_mac_gurmukhi.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to x-mac-gurmukhi + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00d7\u2212\u2013\u2014\u2018\u2019\u2026\u2022\u00a9\u00ae\u2122\u0a71\u0a5c\u0a73\u0a72\u0a74\u0a02\u0a05\u0a06\u0a07\u0a08\u0a09\u0a0a\u0a0f\u0a10\u0a13\u0a14\u0a15\u0a16\u0a17\u0a18\u0a19\u0a1a\u0a1b\u0a1c\u0a1d\u0a1e\u0a1f\u0a20\u0a21\u0a22\u0a23\u0a24\u0a25\u0a26\u0a27\u0a28\u0a2a\u0a2b\u0a2c\u0a2d\u0a2e\u0a2f\u0a30\u0a32\u0a35\uf860\u0a38\u0a39\u200e\u0a3e\u0a3f\u0a40\u0a41\u0a42\u0a47\u0a48\u0a4b\u0a4c\u0a4d\u0a3c\u0964\u0a66\u0a67\u0a68\u0a69\u0a6a\u0a6b\u0a6c\u0a6d\u0a6e\u0a6f"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "x-mac-gurmukhi"; +const aliases = [ "x-mac-gurmukhi" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_x_mac_hebrew.js b/intl/uconv/tests/unit/test_encode_x_mac_hebrew.js index b3e65b0375af..8e607a30c8c7 100644 --- a/intl/uconv/tests/unit/test_encode_x_mac_hebrew.js +++ b/intl/uconv/tests/unit/test_encode_x_mac_hebrew.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to x-mac-hebrew +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\ufb1f\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u20aa\u201e\uf89b\uf89c\uf89d\uf89e\u05bc\ufb4b\ufb35\u2026\u00a0\u05b8\u05b7\u05b5\u05b6\u05b4\u2013\u2014\u201c\u201d\u2018\u2019\ufb2a\ufb2b\u05bf\u05b0\u05b2\u05b1\u05bb\u05b9\u05b3\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5\u05d6\u05d7\u05d8\u05d9\u05da\u05db\u05dc\u05dd\u05de\u05df\u05e0\u05e1\u05e2\u05e3\u05e4\u05e5\u05e6\u05e7\u05e8\u05e9\u05ea"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "x-mac-hebrew"; +const aliases = [ "x-mac-hebrew" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_x_mac_icelandic.js b/intl/uconv/tests/unit/test_encode_x_mac_icelandic.js index 2000c77896c1..2d400c031ca6 100644 --- a/intl/uconv/tests/unit/test_encode_x_mac_icelandic.js +++ b/intl/uconv/tests/unit/test_encode_x_mac_icelandic.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to x-mac-icelandic + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u00dd\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u00c6\u00d8\u221e\u00b1\u2264\u2265\u00a5\u00b5\u2202\u2211\u220f\u03c0\u222b\u00aa\u00ba\u03a9\u00e6\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u00ff\u0178\u2044\u20ac\u00d0\u00f0\u00de\u00fe\u00fd\u00b7\u201a\u201e\u2030\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\uf8ff\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u02d8\u02d9\u02da\u00b8\u02dd\u02db\u02c7"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "x-mac-icelandic"; +const aliases = [ "x-mac-icelandic" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_x_mac_roman.js b/intl/uconv/tests/unit/test_encode_x_mac_roman.js index a8c8371b67e7..fa6b50130595 100644 --- a/intl/uconv/tests/unit/test_encode_x_mac_roman.js +++ b/intl/uconv/tests/unit/test_encode_x_mac_roman.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to x-mac-roman + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u00c6\u00d8\u221e\u00b1\u2264\u2265\u00a5\u00b5\u2202\u2211\u220f\u03c0\u222b\u00aa\u00ba\u03a9\u00e6\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u00ff\u0178\u2044\u20ac\u2039\u203a\ufb01\ufb02\u2021\u00b7\u201a\u201e\u2030\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\uf8ff\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u02d8\u02d9\u02da\u00b8\u02dd\u02db\u02c7"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "x-mac-roman"; +const aliases = [ "csMacintosh", "mac", "macintosh", "x-mac-roman" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_x_mac_romanian.js b/intl/uconv/tests/unit/test_encode_x_mac_romanian.js index 65ab12d7d3fb..3776923adf85 100644 --- a/intl/uconv/tests/unit/test_encode_x_mac_romanian.js +++ b/intl/uconv/tests/unit/test_encode_x_mac_romanian.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to x-mac-romanian + +load('CharsetConversionTests.js'); const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u0102\u0218\u221e\u00b1\u2264\u2265\u00a5\u00b5\u2202\u2211\u220f\u03c0\u222b\u00aa\u00ba\u03a9\u0103\u0219\u00bf\u00a1\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u00ff\u0178\u2044\u20ac\u2039\u203a\u021a\u021b\u2021\u00b7\u201a\u201e\u2030\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\uf8ff\u00d2\u00da\u00db\u00d9\u0131\u02c6\u02dc\u00af\u02d8\u02d9\u02da\u00b8\u02dd\u02db\u02c7"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "x-mac-romanian"; +const aliases = [ "x-mac-romanian" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_x_mac_turkish.js b/intl/uconv/tests/unit/test_encode_x_mac_turkish.js index 2e8c455d6de4..8aaab0665c07 100644 --- a/intl/uconv/tests/unit/test_encode_x_mac_turkish.js +++ b/intl/uconv/tests/unit/test_encode_x_mac_turkish.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to x-mac-turkish +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u00c4\u00c5\u00c7\u00c9\u00d1\u00d6\u00dc\u00e1\u00e0\u00e2\u00e4\u00e3\u00e5\u00e7\u00e9\u00e8\u00ea\u00eb\u00ed\u00ec\u00ee\u00ef\u00f1\u00f3\u00f2\u00f4\u00f6\u00f5\u00fa\u00f9\u00fb\u00fc\u2020\u00b0\u00a2\u00a3\u00a7\u2022\u00b6\u00df\u00ae\u00a9\u2122\u00b4\u00a8\u2260\u00c6\u00d8\u221e\u00b1\u2264\u2265\u00a5\u00b5\u2202\u2211\u220f\u03c0\u222b\u00aa\u00ba\u03a9\u00e6\u00f8\u00bf\u00a1\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u00c0\u00c3\u00d5\u0152\u0153\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u25ca\u00ff\u0178\u011e\u011f\u0130\u0131\u015e\u015f\u2021\u00b7\u201a\u201e\u2030\u00c2\u00ca\u00c1\u00cb\u00c8\u00cd\u00ce\u00cf\u00cc\u00d3\u00d4\uf8ff\u00d2\u00da\u00db\u00d9\uf8a0\u02c6\u02dc\u00af\u02d8\u02d9\u02da\u00b8\u02dd\u02db\u02c7"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "x-mac-turkish"; +const aliases = [ "x-mac-turkish" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); } diff --git a/intl/uconv/tests/unit/test_encode_x_mac_ukrainian.js b/intl/uconv/tests/unit/test_encode_x_mac_ukrainian.js index ed3c82bd0fcc..3538369879b4 100644 --- a/intl/uconv/tests/unit/test_encode_x_mac_ukrainian.js +++ b/intl/uconv/tests/unit/test_encode_x_mac_ukrainian.js @@ -1,19 +1,13 @@ // Tests conversion from Unicode to x-mac-ukrainian +load('CharsetConversionTests.js'); + const inString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u042f\u2020\u00b0\u0490\u00a3\u00a7\u2022\u00b6\u0406\u00ae\u00a9\u2122\u0402\u0452\u2260\u0403\u0453\u221e\u00b1\u2264\u2265\u0456\u00b5\u0491\u0408\u0404\u0454\u0407\u0457\u0409\u0459\u040a\u045a\u0458\u0405\u00ac\u221a\u0192\u2248\u2206\u00ab\u00bb\u2026\u00a0\u040b\u045b\u040c\u045c\u0455\u2013\u2014\u201c\u201d\u2018\u2019\u00f7\u201e\u040e\u045e\u040f\u045f\u2116\u0401\u0451\u044f\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044b\u044c\u044d\u044e\u20ac"; const expectedString = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"; -const charset = "x-mac-ukrainian"; +const aliases = [ "x-mac-ukrainian" ]; function run_test() { - var ScriptableUnicodeConverter = - Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter", - "nsIScriptableUnicodeConverter"); - - var converter = new ScriptableUnicodeConverter(); - converter.charset = charset; - - var outString = converter.ConvertFromUnicode(inString) + converter.Finish(); - do_check_eq(outString, expectedString); + testEncodeAliases(); }