diff --git a/test/chardet.js b/test/chardet.js index 2e1bb16..b73c15b 100644 --- a/test/chardet.js +++ b/test/chardet.js @@ -1,30 +1,30 @@ var assert = require('assert'), - chardet = require('../'), - fs = require('fs'); + chardet = require('../'), + fs = require('fs'); describe('chardet', function() { - var path = __dirname + '/data/encodings/utf8'; + var path = __dirname + '/data/encodings/utf8'; - describe('#detect', function() { - it('should detect encoding', function() { - assert.equal(chardet.detect(fs.readFileSync(path)), 'UTF-8'); - }); + describe('#detect', function() { + it('should detect encoding', function() { + assert.equal(chardet.detect(fs.readFileSync(path)), 'UTF-8'); }); + }); - describe('#detectFile', function() { - it('should detect encoding', function(done) { - chardet.detectFile(path, function(err, res) { - assert.equal(err, null); - assert.equal(res, 'UTF-8'); - done(); - }); - }); + describe('#detectFile', function() { + it('should detect encoding', function(done) { + chardet.detectFile(path, function(err, res) { + assert.equal(err, null); + assert.equal(res, 'UTF-8'); + done(); + }); }); + }); - describe('#detectFileSync', function() { - it('should detect encoding', function() { - assert.equal(chardet.detectFileSync(path), 'UTF-8'); - }); + describe('#detectFileSync', function() { + it('should detect encoding', function() { + assert.equal(chardet.detectFileSync(path), 'UTF-8'); }); -}); \ No newline at end of file + }); +}); diff --git a/test/encodings/iso2022.js b/test/encodings/iso2022.js index 883f04a..de23a97 100644 --- a/test/encodings/iso2022.js +++ b/test/encodings/iso2022.js @@ -1,29 +1,28 @@ - var assert = require('assert'), - chardet = require('../../'); + chardet = require('../../'); describe('ISO-2022', function() { - var base = __dirname + '/../data/encodings'; + var base = __dirname + '/../data/encodings'; - it('should return ISO-2022-JP', function() { - assert.equal( - chardet.detectFileSync(base + '/iso2022jp'), - 'ISO-2022-JP' - ); - }); + it('should return ISO-2022-JP', function() { + assert.equal( + chardet.detectFileSync(base + '/iso2022jp'), + 'ISO-2022-JP' + ); + }); - it('should return ISO-2022-KR', function() { - assert.equal( - chardet.detectFileSync(base + '/iso2022kr'), - 'ISO-2022-KR' - ); - }); + it('should return ISO-2022-KR', function() { + assert.equal( + chardet.detectFileSync(base + '/iso2022kr'), + 'ISO-2022-KR' + ); + }); - it('should return ISO-2022-CN', function() { - assert.equal( - chardet.detectFileSync(base + '/iso2022cn'), - 'ISO-2022-CN' - ); - }); -}); \ No newline at end of file + it('should return ISO-2022-CN', function() { + assert.equal( + chardet.detectFileSync(base + '/iso2022cn'), + 'ISO-2022-CN' + ); + }); +}); diff --git a/test/encodings/mbcs.js b/test/encodings/mbcs.js index 3d60aaa..26060eb 100644 --- a/test/encodings/mbcs.js +++ b/test/encodings/mbcs.js @@ -1,44 +1,43 @@ - var assert = require('assert'), - chardet = require('../../'); + chardet = require('../../'); describe('Multybyte Character Sets', function() { - var base = __dirname + '/../data/encodings'; + var base = __dirname + '/../data/encodings'; - it('should return SHIFT-JIS', function() { - assert.equal( - chardet.detectFileSync(base + '/shiftjis'), - 'Shift-JIS' - ); - }); + it('should return SHIFT-JIS', function() { + assert.equal( + chardet.detectFileSync(base + '/shiftjis'), + 'Shift-JIS' + ); + }); - it('should return GB18030', function() { - assert.equal( - chardet.detectFileSync(base + '/gb18030'), - 'GB18030' - ); - }); + it('should return GB18030', function() { + assert.equal( + chardet.detectFileSync(base + '/gb18030'), + 'GB18030' + ); + }); - it('should return Big5', function() { - assert.equal( - chardet.detectFileSync(base + '/big5'), - 'Big5' - ); - }); + it('should return Big5', function() { + assert.equal( + chardet.detectFileSync(base + '/big5'), + 'Big5' + ); + }); - it('should return EUC-JP', function() { - assert.equal( - chardet.detectFileSync(base + '/euc_jp'), - 'EUC-JP' - ); - }); + it('should return EUC-JP', function() { + assert.equal( + chardet.detectFileSync(base + '/euc_jp'), + 'EUC-JP' + ); + }); - it('should return EUC-KR', function() { - assert.equal( - chardet.detectFileSync(base + '/euc_kr'), - 'EUC-KR' - ); - }); + it('should return EUC-KR', function() { + assert.equal( + chardet.detectFileSync(base + '/euc_kr'), + 'EUC-KR' + ); + }); -}); \ No newline at end of file +}); diff --git a/test/encodings/sbcs.js b/test/encodings/sbcs.js index e6588f6..cfa0654 100644 --- a/test/encodings/sbcs.js +++ b/test/encodings/sbcs.js @@ -1,112 +1,111 @@ - var assert = require('assert'), - chardet = require('../../'); + chardet = require('../../'); describe('Singlebyte Character Sets', function() { - var base = __dirname + '/../data/encodings'; + var base = __dirname + '/../data/encodings'; - it('should return ISO-8859-1 (English)', function() { - assert.equal( - chardet.detectFileSync(base + '/iso88591_en'), 'ISO-8859-1' - ); - }); + it('should return ISO-8859-1 (English)', function() { + assert.equal( + chardet.detectFileSync(base + '/iso88591_en'), 'ISO-8859-1' + ); + }); - it('should return ISO-8859-2 (Czech)', function() { - assert.equal( - chardet.detectFileSync(base + '/iso88592_cs'), 'ISO-8859-2' - ); - }); + it('should return ISO-8859-2 (Czech)', function() { + assert.equal( + chardet.detectFileSync(base + '/iso88592_cs'), 'ISO-8859-2' + ); + }); - it('should return ISO-8859-3'); - it('should return ISO-8859-4'); + it('should return ISO-8859-3'); + it('should return ISO-8859-4'); - it('should return ISO-8859-5 (Russian)', function() { - assert.equal( - chardet.detectFileSync(base + '/iso88595_ru'), 'ISO-8859-5' - ); - }); + it('should return ISO-8859-5 (Russian)', function() { + assert.equal( + chardet.detectFileSync(base + '/iso88595_ru'), 'ISO-8859-5' + ); + }); - it('should return ISO-8859-6 (Arabic)', function() { - assert.equal( - chardet.detectFileSync(base + '/iso88596_ar'), 'ISO-8859-6' - ); - }); + it('should return ISO-8859-6 (Arabic)', function() { + assert.equal( + chardet.detectFileSync(base + '/iso88596_ar'), 'ISO-8859-6' + ); + }); - it('should return ISO-8859-7 (Greek)', function() { - assert.equal( - chardet.detectFileSync(base + '/iso88597_el'), 'ISO-8859-7' - ); - }); + it('should return ISO-8859-7 (Greek)', function() { + assert.equal( + chardet.detectFileSync(base + '/iso88597_el'), 'ISO-8859-7' + ); + }); - it('should return ISO-8859-8 (Hebrew)', function() { - assert.equal( - chardet.detectFileSync(base + '/iso88598_he'), 'ISO-8859-8' - ); - }); + it('should return ISO-8859-8 (Hebrew)', function() { + assert.equal( + chardet.detectFileSync(base + '/iso88598_he'), 'ISO-8859-8' + ); + }); - it('should return ISO-8859-9 (Turkish)', function() { - assert.equal( - chardet.detectFileSync(base + '/iso88599_tr'), 'ISO-8859-9' - ); - }); + it('should return ISO-8859-9 (Turkish)', function() { + assert.equal( + chardet.detectFileSync(base + '/iso88599_tr'), 'ISO-8859-9' + ); + }); - it('should return ISO-8859-10'); - it('should return ISO-8859-11'); - // iso-8859-12 is abandoned - it('should return ISO-8859-13'); - it('should return ISO-8859-14'); - it('should return ISO-8859-15'); - it('should return ISO-8859-16'); + it('should return ISO-8859-10'); + it('should return ISO-8859-11'); + // iso-8859-12 is abandoned + it('should return ISO-8859-13'); + it('should return ISO-8859-14'); + it('should return ISO-8859-15'); + it('should return ISO-8859-16'); - it('should return windows-1250 (Czech)', function() { - assert.equal( - chardet.detectFileSync(base + '/windows_1250'), 'windows-1250' - ); - }); + it('should return windows-1250 (Czech)', function() { + assert.equal( + chardet.detectFileSync(base + '/windows_1250'), 'windows-1250' + ); + }); - it('should return windows-1251 (Russian)', function() { - assert.equal( - chardet.detectFileSync(base + '/windows_1251'), 'windows-1251' - ); - }); + it('should return windows-1251 (Russian)', function() { + assert.equal( + chardet.detectFileSync(base + '/windows_1251'), 'windows-1251' + ); + }); - it('should return windows-1252 (English)', function() { - assert.equal( - chardet.detectFileSync(base + '/windows_1252'), 'windows-1252' - ); - }); + it('should return windows-1252 (English)', function() { + assert.equal( + chardet.detectFileSync(base + '/windows_1252'), 'windows-1252' + ); + }); - it('should return windows-1253 (Greek)', function() { - assert.equal( - chardet.detectFileSync(base + '/windows_1253'), 'windows-1253' - ); - }); + it('should return windows-1253 (Greek)', function() { + assert.equal( + chardet.detectFileSync(base + '/windows_1253'), 'windows-1253' + ); + }); - it('should return windows-1254 (Turkish)', function() { - assert.equal( - chardet.detectFileSync(base + '/windows_1254'), 'windows-1254' - ); - }); + it('should return windows-1254 (Turkish)', function() { + assert.equal( + chardet.detectFileSync(base + '/windows_1254'), 'windows-1254' + ); + }); - it('should return windows-1255 (Hebrew)', function() { - assert.equal( - chardet.detectFileSync(base + '/windows_1255'), 'windows-1255' - ); - }); + it('should return windows-1255 (Hebrew)', function() { + assert.equal( + chardet.detectFileSync(base + '/windows_1255'), 'windows-1255' + ); + }); - it('should return windows-1256 (Arabic)', function() { - assert.equal( - chardet.detectFileSync(base + '/windows_1256'), 'windows-1256' - ); - }); + it('should return windows-1256 (Arabic)', function() { + assert.equal( + chardet.detectFileSync(base + '/windows_1256'), 'windows-1256' + ); + }); - it('should return KOI8-R (Russian)', function() { - assert.equal( - chardet.detectFileSync(base + '/koi8r'), 'KOI8-R' - ); - }); + it('should return KOI8-R (Russian)', function() { + assert.equal( + chardet.detectFileSync(base + '/koi8r'), 'KOI8-R' + ); + }); -}); \ No newline at end of file +}); diff --git a/test/encodings/unicode.js b/test/encodings/unicode.js index 4502e97..880b891 100644 --- a/test/encodings/unicode.js +++ b/test/encodings/unicode.js @@ -1,36 +1,35 @@ - var assert = require('assert'), - chardet = require('../../'); + chardet = require('../../'); describe('Unicode', function() { - var base = __dirname + '/../data/encodings'; + var base = __dirname + '/../data/encodings'; - it('should return UTF-16LE', function() { - assert.equal( - chardet.detectFileSync(base + '/utf16le'), - 'UTF-16LE' - ); - }); + it('should return UTF-16LE', function() { + assert.equal( + chardet.detectFileSync(base + '/utf16le'), + 'UTF-16LE' + ); + }); - it('should return UTF-16BE', function() { - assert.equal( - chardet.detectFileSync(base + '/utf16be'), - 'UTF-16BE' - ); - }); + it('should return UTF-16BE', function() { + assert.equal( + chardet.detectFileSync(base + '/utf16be'), + 'UTF-16BE' + ); + }); - it('should return UTF-32LE', function() { - assert.equal( - chardet.detectFileSync(base + '/utf32le'), - 'UTF-32LE' - ); - }); + it('should return UTF-32LE', function() { + assert.equal( + chardet.detectFileSync(base + '/utf32le'), + 'UTF-32LE' + ); + }); - it('should return UTF-32BE', function() { - assert.equal( - chardet.detectFileSync(base + '/utf32be'), - 'UTF-32BE' - ); - }); -}); \ No newline at end of file + it('should return UTF-32BE', function() { + assert.equal( + chardet.detectFileSync(base + '/utf32be'), + 'UTF-32BE' + ); + }); +}); diff --git a/test/encodings/utf8.js b/test/encodings/utf8.js index 14db5db..a07b9b0 100644 --- a/test/encodings/utf8.js +++ b/test/encodings/utf8.js @@ -1,12 +1,11 @@ - var assert = require('assert'), - chardet = require('../../'); + chardet = require('../../'); describe('UTF-8', function() { - it('should return UTF-8', function() { - assert.equal( - chardet.detectFileSync(__dirname + '/../data/encodings/utf8'), - 'UTF-8' - ); - }); -}); \ No newline at end of file + it('should return UTF-8', function() { + assert.equal( + chardet.detectFileSync(__dirname + '/../data/encodings/utf8'), + 'UTF-8' + ); + }); +});