diff options
author | Yuchen Pei <hi@ypei.me> | 2022-07-28 15:32:10 +1000 |
---|---|---|
committer | Yuchen Pei <hi@ypei.me> | 2022-07-28 15:32:10 +1000 |
commit | 5b10a10743b8459f64fe83e0ff420f69da79c9a4 (patch) | |
tree | c61904d688247790181d4955a4074b8c94302c03 /hash_script/node_modules/encoding/test | |
parent | b98cb70b1bcd5b211aaa5d2675f96416911c0647 (diff) |
Moving scripts and utilities into a new utilities dir
Diffstat (limited to 'hash_script/node_modules/encoding/test')
-rw-r--r-- | hash_script/node_modules/encoding/test/test.js | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/hash_script/node_modules/encoding/test/test.js b/hash_script/node_modules/encoding/test/test.js deleted file mode 100644 index 0de4dcb..0000000 --- a/hash_script/node_modules/encoding/test/test.js +++ /dev/null @@ -1,75 +0,0 @@ -'use strict'; - -var Iconv = require('../lib/iconv-loader'); -var encoding = require('../lib/encoding'); - -exports['General tests'] = { - - 'Iconv is available': function (test) { - test.ok(Iconv); - test.done(); - }, - - 'From UTF-8 to Latin_1 with Iconv': function (test) { - var input = 'ÕÄÖÜ', - expected = new Buffer([0xd5, 0xc4, 0xd6, 0xdc]); - test.deepEqual(encoding.convert(input, 'latin1'), expected); - test.done(); - }, - - 'From Latin_1 to UTF-8 with Iconv': function (test) { - var input = new Buffer([0xd5, 0xc4, 0xd6, 0xdc]), - expected = 'ÕÄÖÜ'; - test.deepEqual(encoding.convert(input, 'utf-8', 'latin1').toString(), expected); - test.done(); - }, - - 'From UTF-8 to UTF-8 with Iconv': function (test) { - var input = 'ÕÄÖÜ', - expected = new Buffer('ÕÄÖÜ'); - test.deepEqual(encoding.convert(input, 'utf-8', 'utf-8'), expected); - test.done(); - }, - - 'From Latin_13 to Latin_15 with Iconv': function (test) { - var input = new Buffer([0xd5, 0xc4, 0xd6, 0xdc, 0xd0]), - expected = new Buffer([0xd5, 0xc4, 0xd6, 0xdc, 0xA6]); - test.deepEqual(encoding.convert(input, 'latin_15', 'latin13'), expected); - test.done(); - }, - - 'From ISO-2022-JP to UTF-8 with Iconv': function (test) { - var input = new Buffer('GyRCM1g5OzU7PVEwdzgmPSQ4IUYkMnFKczlwGyhC', 'base64'), - expected = new Buffer('5a2m5qCh5oqA6KGT5ZOh56CU5L+u5qSc6KiO5Lya5aCx5ZGK', 'base64'); - test.deepEqual(encoding.convert(input, 'utf-8', 'ISO-2022-JP'), expected); - test.done(); - }, - - 'From UTF-8 to Latin_1 with iconv-lite': function (test) { - var input = 'ÕÄÖÜ', - expected = new Buffer([0xd5, 0xc4, 0xd6, 0xdc]); - test.deepEqual(encoding.convert(input, 'latin1', false, true), expected); - test.done(); - }, - - 'From Latin_1 to UTF-8 with iconv-lite': function (test) { - var input = new Buffer([0xd5, 0xc4, 0xd6, 0xdc]), - expected = 'ÕÄÖÜ'; - test.deepEqual(encoding.convert(input, 'utf-8', 'latin1', true).toString(), expected); - test.done(); - }, - - 'From UTF-8 to UTF-8 with iconv-lite': function (test) { - var input = 'ÕÄÖÜ', - expected = new Buffer('ÕÄÖÜ'); - test.deepEqual(encoding.convert(input, 'utf-8', 'utf-8', true), expected); - test.done(); - }, - - 'From Latin_13 to Latin_15 with iconv-lite': function (test) { - var input = new Buffer([0xd5, 0xc4, 0xd6, 0xdc, 0xd0]), - expected = new Buffer([0xd5, 0xc4, 0xd6, 0xdc, 0xA6]); - test.deepEqual(encoding.convert(input, 'latin_15', 'latin13', true), expected); - test.done(); - } -}; |