intl/uconv/tests/unit/test_bug367026.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Tests conversion from Unicode to HZ-GB-2312 (bug 367026)
michael@0 2 *
michael@0 3 * Notes:
michael@0 4 * HZ-GB-2312 is a 7-bit encoding of the GB2312 simplified Chinese character
michael@0 5 * set. It uses the escape sequences "~{" to mark the start of GB encoded text
michael@0 6 * and "~}" to mark the end.
michael@0 7 *
michael@0 8 * See http://www.ietf.org/rfc/rfc1843.txt
michael@0 9 */
michael@0 10
michael@0 11 load('CharsetConversionTests.js');
michael@0 12
michael@0 13 const inASCII = "Hello World";
michael@0 14 const inHanzi = "\u4E00";
michael@0 15 const inMixed = "Hello \u4E00 World";
michael@0 16
michael@0 17 const expectedASCII = "Hello World";
michael@0 18 const expectedHanzi = "~{R;~}";
michael@0 19 const expectedMixed = "Hello ~{R;~} World";
michael@0 20
michael@0 21 const charset = "HZ-GB-2312";
michael@0 22
michael@0 23 function run_test() {
michael@0 24 var converter = CreateScriptableConverter();
michael@0 25
michael@0 26 checkEncode(converter, charset, inASCII, expectedASCII);
michael@0 27 checkEncode(converter, charset, inMixed, expectedMixed);
michael@0 28 checkEncode(converter, charset, inHanzi, expectedHanzi);
michael@0 29 }

mercurial