[Pkg-javascript-commits] [node-iconv-lite] 62/83: Slightly corrected big5 tests, added test case from #25.

matthew pideil mpideil-guest at moszumanska.debian.org
Tue Apr 1 19:56:51 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 2cb743669089337247e29b5b89bb91df6036a320
Author: Alexander Shtuchkin <ashtuchkin at gmail.com>
Date:   Wed Apr 17 00:30:49 2013 +0400

    Slightly corrected big5 tests, added test case from #25.
---
 test/big5-test.js | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/test/big5-test.js b/test/big5-test.js
index b3949e6..f3fe1a8 100644
--- a/test/big5-test.js
+++ b/test/big5-test.js
@@ -4,18 +4,16 @@ var vows    = require('vows'),
     iconv   = require(__dirname + '/../');
 
 var testString = "中文abc", //unicode contains Big5-code and ascii
-    testStringBig5Buffer = new Buffer([0xa4,0xa4,0xa4,0xe5,0x61,0x62,0x63]);
+    testStringBig5Buffer = new Buffer([0xa4,0xa4,0xa4,0xe5,0x61,0x62,0x63]),
+    testString2 = '測試',
+    testStringBig5Buffer2 = new Buffer([0xb4, 0xfa, 0xb8, 0xd5]);
 
 vows.describe("Big5 tests").addBatch({
-    "Vows is working": function() {},
-    "Return values are of correct types": function() {
-        assert.ok(iconv.toEncoding(testString, "utf8") instanceof Buffer);        
-        var s = iconv.fromEncoding(new Buffer(testString), "utf8");
-        assert.strictEqual(Object.prototype.toString.call(s), "[object String]");
-    },
     "Big5 correctly encoded/decoded": function() {    
         assert.strictEqual(iconv.toEncoding(testString, "big5").toString('binary'), testStringBig5Buffer.toString('binary'));
         assert.strictEqual(iconv.fromEncoding(testStringBig5Buffer, "big5"), testString);
+        assert.strictEqual(iconv.toEncoding(testString2, 'big5').toString('binary'), testStringBig5Buffer2.toString('binary'));
+        assert.strictEqual(iconv.fromEncoding(testStringBig5Buffer2, 'big5'), testString2);
     },
     "cp950 correctly encoded/decoded": function() {    
         assert.strictEqual(iconv.toEncoding(testString, "cp950").toString('binary'), testStringBig5Buffer.toString('binary'));
@@ -28,12 +26,11 @@ vows.describe("Big5 tests").addBatch({
         assert.strictEqual(iconvc.convert(contentBuffer).toString(), str);
     },
     "Big5 correctly decodes and encodes characters · and ×": function() {
-				// Also make a test in Big5 (cp950).
         // https://github.com/ashtuchkin/iconv-lite/issues/13
         // Reference: http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP950.TXT
         var chars = "·×";
-        var gbkChars = new Buffer([0xA1, 0x50, 0xA1, 0xD1]);
-        assert.strictEqual(iconv.toEncoding(chars, "big5").toString('binary'), gbkChars.toString('binary'));
-        assert.strictEqual(iconv.fromEncoding(gbkChars, "big5"), chars)
+        var big5Chars = new Buffer([0xA1, 0x50, 0xA1, 0xD1]);
+        assert.strictEqual(iconv.toEncoding(chars, "big5").toString('binary'), big5Chars.toString('binary'));
+        assert.strictEqual(iconv.fromEncoding(big5Chars, "big5"), chars)
     },
 }).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