[Pkg-javascript-commits] [node-iconv-lite] 73/83: Added tests for CP949
matthew pideil
mpideil-guest at moszumanska.debian.org
Tue Apr 1 19:56:53 UTC 2014
This is an automated email from the git hooks/post-receive script.
mpideil-guest pushed a commit to branch master
in repository node-iconv-lite.
commit 03087cc2f29d2bc35de7b667d45219219f9929aa
Author: Dan Gibson <dan at gandale.com>
Date: Thu Aug 8 13:25:54 2013 +1000
Added tests for CP949
---
encodings/cp949.js | 3 ++-
test/cp949-test.js | 18 ++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/encodings/cp949.js b/encodings/cp949.js
index ceb838e..3ec1c5d 100644
--- a/encodings/cp949.js
+++ b/encodings/cp949.js
@@ -13,11 +13,12 @@ for (i=0; i<lines.length; i++)
{
col = line.split('\t');
cp949Table[parseInt(col[0],16)] = parseInt(col[1],16);
+ //cp949Table[parseInt(col[0],16)] = 51; // 3
}
}
module.exports = {
- 'ks_c_5601-1987': 'cp949',
+ 'ks_c_56011987': 'cp949',
'cp949': {
type: 'table',
table: cp949Table
diff --git a/test/cp949-test.js b/test/cp949-test.js
new file mode 100644
index 0000000..894beb0
--- /dev/null
+++ b/test/cp949-test.js
@@ -0,0 +1,18 @@
+var vows = require('vows'),
+ assert = require('assert'),
+ iconv = require(__dirname+'/../');
+
+var testStringUtf = "\u00ba\u00b0\uc96fabc",
+ testStringCP949Buffer = new Buffer([0xa8,0xac, 0xa1,0xc6, 0xa2,0xa0, 0x61, 0x62, 0x63]);
+
+vows.describe("CP949 tests").addBatch({
+ "Vows is working": function() {},
+ "CP949 correctly encoded/decoded": function() {
+ assert.strictEqual(iconv.toEncoding(testStringUtf, "cp949").toString('binary'), testStringCP949Buffer.toString('binary'));
+ assert.strictEqual(iconv.fromEncoding(testStringCP949Buffer, "cp949"), testStringUtf);
+ },
+ "ks_c_5601-1987 correctly encoded/decoded": function() {
+ assert.strictEqual(iconv.toEncoding(testStringUtf, "ks_c_5601-1987").toString('binary'), testStringCP949Buffer.toString('binary'));
+ assert.strictEqual(iconv.fromEncoding(testStringCP949Buffer, "ks_c_5601-1987"), testStringUtf);
+ },
+}).export(module)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-iconv-lite.git
More information about the Pkg-javascript-commits
mailing list