Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinmetcalf committed Aug 19, 2016
1 parent 1626ce2 commit 613315e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
10 changes: 10 additions & 0 deletions build/test-replacements.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ module.exports['test-stream2-transform.js'] = [
module.exports['test-stream2-writable.js'] = [
altForEachImplReplacement
, altForEachUseReplacement
, [
/'latin1',/g,
'\'binary\','
]
]

module.exports['test-stream-big-packet.js'] = [
Expand Down Expand Up @@ -274,3 +278,9 @@ module.exports['test-stream2-readable-from-list.js'] = [
'require(\'../../lib/internal/streams/BufferList\')'
]
]
module.exports['test-stream-writev.js'] = [
[
/'latin1'/g,
`'binary'`
]
]
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"devDependencies": {
"assert": "~1.4.0",
"babel-polyfill": "^6.9.1",
"buffer": "^4.9.0",
"nyc": "^6.4.0",
"tap": "~0.7.1",
"tape": "~4.5.1",
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/file-to-read-with-bom.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
abc
def
ghi
3 changes: 3 additions & 0 deletions test/fixtures/file-to-read-without-bom.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
abc
def
ghi
4 changes: 2 additions & 2 deletions test/parallel/test-stream-writev.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function test(decode, uncork, multi, next) {
chunk: [119, 111, 114, 108, 100] }, { encoding: 'buffer',
chunk: [33] }, { encoding: 'buffer',
chunk: [10, 97, 110, 100, 32, 116, 104, 101, 110, 46, 46, 46] }, { encoding: 'buffer',
chunk: [250, 206, 190, 167, 222, 173, 190, 239, 222, 202, 251, 173] }] : [{ encoding: 'ascii', chunk: 'hello, ' }, { encoding: 'utf8', chunk: 'world' }, { encoding: 'buffer', chunk: [33] }, { encoding: 'latin1', chunk: '\nand then...' }, { encoding: 'hex', chunk: 'facebea7deadbeefdecafbad' }];
chunk: [250, 206, 190, 167, 222, 173, 190, 239, 222, 202, 251, 173] }] : [{ encoding: 'ascii', chunk: 'hello, ' }, { encoding: 'utf8', chunk: 'world' }, { encoding: 'buffer', chunk: [33] }, { encoding: 'binary', chunk: '\nand then...' }, { encoding: 'hex', chunk: 'facebea7deadbeefdecafbad' }];

var actualChunks;
w._writev = function (chunks, cb) {
Expand All @@ -66,7 +66,7 @@ function test(decode, uncork, multi, next) {
if (multi) w.cork();

w.write(bufferShim.from('!'), 'buffer', cnt('!'));
w.write('\nand then...', 'latin1', cnt('and then'));
w.write('\nand then...', 'binary', cnt('and then'));

if (multi) w.uncork();

Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-stream2-writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ test('write bufferize', function (t) {
highWaterMark: 100
});

var encodings = ['hex', 'utf8', 'utf-8', 'ascii', 'latin1', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', undefined];
var encodings = ['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', undefined];

tw.on('finish', function () {
t.same(tw.buffer, chunks, 'got the expected chunks');
Expand All @@ -159,7 +159,7 @@ test('write no bufferize', function (t) {
return TestWriter.prototype._write.call(this, chunk, encoding, cb);
};

var encodings = ['hex', 'utf8', 'utf-8', 'ascii', 'latin1', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', undefined];
var encodings = ['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', undefined];

tw.on('finish', function () {
t.same(tw.buffer, chunks, 'got the expected chunks');
Expand Down

0 comments on commit 613315e

Please sign in to comment.