From 3aa1b241c2e61b190f6d24801451d4d768f70b6c Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Tue, 19 Apr 2016 23:02:09 -0700 Subject: [PATCH] fix firefox strict mode error --- bin/download-node-tests.js | 5 +---- test/node/test-buffer-alloc.js | 5 +---- test/node/test-buffer-arraybuffer.js | 5 +---- test/node/test-buffer-ascii.js | 5 +---- test/node/test-buffer-bad-overload.js | 5 +---- test/node/test-buffer-bytelength.js | 5 +---- test/node/test-buffer-compare-offset.js | 5 +---- test/node/test-buffer-concat.js | 5 +---- test/node/test-buffer-fill.js | 5 +---- test/node/test-buffer-includes.js | 5 +---- test/node/test-buffer-indexof.js | 5 +---- test/node/test-buffer-inheritance.js | 5 +---- test/node/test-buffer-inspect.js | 5 +---- test/node/test-buffer-iterator.js | 5 +---- test/node/test-buffer-safe-unsafe.js | 5 +---- test/node/test-buffer-slow.js | 5 +---- test/node/test-buffer-swap.js | 5 +---- test/node/test-buffer-zero-fill-cli.js | 5 +---- test/node/test-buffer-zero-fill-reset.js | 5 +---- test/node/test-buffer.js | 5 +---- 20 files changed, 20 insertions(+), 80 deletions(-) diff --git a/bin/download-node-tests.js b/bin/download-node-tests.js index 6fe1f85..3209d17 100755 --- a/bin/download-node-tests.js +++ b/bin/download-node-tests.js @@ -66,7 +66,7 @@ function testfixer (filename) { if (firstline) { // require buffer explicitly var preamble = 'var Buffer = require(\'../../\').Buffer;\n' + - 'if (Buffer.TYPED_ARRAY_SUPPORT) {' + 'if (Buffer.TYPED_ARRAY_SUPPORT) return;' if (/use strict/.test(line)) line += '\n' + preamble else line + preamble + '\n' + line firstline = false @@ -103,8 +103,5 @@ function testfixer (filename) { } cb(null, line + '\n') - }, function (cb) { - // flush function - this.push('\n}') }) } diff --git a/test/node/test-buffer-alloc.js b/test/node/test-buffer-alloc.js index 74060f3..9bbe390 100644 --- a/test/node/test-buffer-alloc.js +++ b/test/node/test-buffer-alloc.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; var common = {}; var assert = require('assert'); @@ -1447,6 +1447,3 @@ assert(ubuf); assert(ubuf.buffer); assert.equal(ubuf.buffer.byteLength, 10); - - -} diff --git a/test/node/test-buffer-arraybuffer.js b/test/node/test-buffer-arraybuffer.js index b768d46..6e0698d 100644 --- a/test/node/test-buffer-arraybuffer.js +++ b/test/node/test-buffer-arraybuffer.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; var assert = require('assert'); @@ -110,6 +110,3 @@ b.writeDoubleBE(11.11, 0, true); }); } - - -} \ No newline at end of file diff --git a/test/node/test-buffer-ascii.js b/test/node/test-buffer-ascii.js index 2f22dd9..b53fb94 100644 --- a/test/node/test-buffer-ascii.js +++ b/test/node/test-buffer-ascii.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; var assert = require('assert'); @@ -26,6 +26,3 @@ for (var i = 0; i < expected.length; ++i) { if (input.charCodeAt(i) > 127) ++i; } - - -} \ No newline at end of file diff --git a/test/node/test-buffer-bad-overload.js b/test/node/test-buffer-bad-overload.js index 00a75b0..6ed07f3 100644 --- a/test/node/test-buffer-bad-overload.js +++ b/test/node/test-buffer-bad-overload.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; var assert = require('assert'); @@ -16,6 +16,3 @@ assert.doesNotThrow(function() { Buffer.from('deadbeaf', 'hex'); }); - - -} \ No newline at end of file diff --git a/test/node/test-buffer-bytelength.js b/test/node/test-buffer-bytelength.js index f50df49..3a9a0ce 100644 --- a/test/node/test-buffer-bytelength.js +++ b/test/node/test-buffer-bytelength.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; var assert = require('assert'); @@ -87,6 +87,3 @@ assert.equal(Buffer.byteLength('Il était tué', 'binary'), 12); assert.equal(24, Buffer.byteLength('Il était tué', encoding)); }); - - -} \ No newline at end of file diff --git a/test/node/test-buffer-compare-offset.js b/test/node/test-buffer-compare-offset.js index 2051de7..76caee6 100644 --- a/test/node/test-buffer-compare-offset.js +++ b/test/node/test-buffer-compare-offset.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; var assert = require('assert'); @@ -64,6 +64,3 @@ assert.throws(() => a.compare(b, 0, Infinity), oor); assert.throws(() => a.compare(b, -Infinity, Infinity), oor); assert.throws(() => a.compare(), /Argument must be a Buffer/); - - -} \ No newline at end of file diff --git a/test/node/test-buffer-concat.js b/test/node/test-buffer-concat.js index a518593..627e3c7 100644 --- a/test/node/test-buffer-concat.js +++ b/test/node/test-buffer-concat.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; var assert = require('assert'); @@ -38,6 +38,3 @@ function assertWrongList(value) { }); } - - -} \ No newline at end of file diff --git a/test/node/test-buffer-fill.js b/test/node/test-buffer-fill.js index 3a21d37..b65cd99 100644 --- a/test/node/test-buffer-fill.js +++ b/test/node/test-buffer-fill.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; var assert = require('assert'); @@ -242,6 +242,3 @@ function testBufs(string, offset, length, encoding) { writeToFill.apply(null, arguments)); } - - -} \ No newline at end of file diff --git a/test/node/test-buffer-includes.js b/test/node/test-buffer-includes.js index c4757cf..084c637 100644 --- a/test/node/test-buffer-includes.js +++ b/test/node/test-buffer-includes.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; var assert = require('assert'); @@ -259,6 +259,3 @@ assert.throws(function() { b.includes([]); }); - - -} \ No newline at end of file diff --git a/test/node/test-buffer-indexof.js b/test/node/test-buffer-indexof.js index 8b900ae..87d29cd 100644 --- a/test/node/test-buffer-indexof.js +++ b/test/node/test-buffer-indexof.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; var assert = require('assert'); @@ -285,6 +285,3 @@ assert.throws(function() { b.indexOf([]); }); - - -} \ No newline at end of file diff --git a/test/node/test-buffer-inheritance.js b/test/node/test-buffer-inheritance.js index d0683ee..8dbfa7f 100644 --- a/test/node/test-buffer-inheritance.js +++ b/test/node/test-buffer-inheritance.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; var assert = require('assert'); @@ -40,6 +40,3 @@ vals.forEach(function(t) { t.toString(); }); - - -} \ No newline at end of file diff --git a/test/node/test-buffer-inspect.js b/test/node/test-buffer-inspect.js index 37daa72..b8658b0 100644 --- a/test/node/test-buffer-inspect.js +++ b/test/node/test-buffer-inspect.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; var assert = require('assert'); @@ -39,6 +39,3 @@ assert.doesNotThrow(function() { assert.strictEqual(util.inspect(s), expected); }); - - -} \ No newline at end of file diff --git a/test/node/test-buffer-iterator.js b/test/node/test-buffer-iterator.js index f9de4c1..33f406d 100644 --- a/test/node/test-buffer-iterator.js +++ b/test/node/test-buffer-iterator.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; var assert = require('assert'); @@ -63,6 +63,3 @@ assert.deepEqual(arr, [ [4, 5] ]); - - -} \ No newline at end of file diff --git a/test/node/test-buffer-safe-unsafe.js b/test/node/test-buffer-safe-unsafe.js index 49a645d..ce7b779 100644 --- a/test/node/test-buffer-safe-unsafe.js +++ b/test/node/test-buffer-safe-unsafe.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; var assert = require('assert'); @@ -25,6 +25,3 @@ assert(isZeroFilled(new Float64Array(10))); Buffer.allocUnsafe(10); assert(isZeroFilled(Buffer.alloc(10))); - - -} \ No newline at end of file diff --git a/test/node/test-buffer-slow.js b/test/node/test-buffer-slow.js index f9ad815..6d89e5e 100644 --- a/test/node/test-buffer-slow.js +++ b/test/node/test-buffer-slow.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; var assert = require('assert'); @@ -57,6 +57,3 @@ assert.throws(function() { SlowBuffer(buffer.kMaxLength + 1); }, 'invalid Buffer length'); - - -} \ No newline at end of file diff --git a/test/node/test-buffer-swap.js b/test/node/test-buffer-swap.js index db5ccd8..ebb044b 100644 --- a/test/node/test-buffer-swap.js +++ b/test/node/test-buffer-swap.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; var assert = require('assert'); @@ -61,6 +61,3 @@ assert.throws(() => Buffer.from(buf3).swap32(), re32); assert.throws(() => buf3.slice(1, 3).swap32(), re32); assert.throws(() => Buffer.alloc(1025).swap32(), re32); - - -} \ No newline at end of file diff --git a/test/node/test-buffer-zero-fill-cli.js b/test/node/test-buffer-zero-fill-cli.js index 3be6575..c65a07e 100644 --- a/test/node/test-buffer-zero-fill-cli.js +++ b/test/node/test-buffer-zero-fill-cli.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; // Flags: --zero-fill-buffers // when using --zero-fill-buffers, every Buffer and SlowBuffer @@ -33,6 +33,3 @@ for (var i = 0; i < 50; i++) { } } - - -} \ No newline at end of file diff --git a/test/node/test-buffer-zero-fill-reset.js b/test/node/test-buffer-zero-fill-reset.js index 3b33b2a..f0cd1de 100644 --- a/test/node/test-buffer-zero-fill-reset.js +++ b/test/node/test-buffer-zero-fill-reset.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; var assert = require('assert'); @@ -20,6 +20,3 @@ for (var i = 0; i < 100; i++) { assert.ok(testUint8Array(ui), 'Uint8Array is not zero-filled'); } - - -} \ No newline at end of file diff --git a/test/node/test-buffer.js b/test/node/test-buffer.js index 4636ea2..e68b604 100644 --- a/test/node/test-buffer.js +++ b/test/node/test-buffer.js @@ -1,6 +1,6 @@ 'use strict'; var Buffer = require('../../').Buffer; -if (Buffer.TYPED_ARRAY_SUPPORT) { +if (Buffer.TYPED_ARRAY_SUPPORT) return; var common = {}; var assert = require('assert'); @@ -1444,6 +1444,3 @@ assert.equal(Buffer.prototype.offset, undefined); assert.equal(SlowBuffer.prototype.parent, undefined); assert.equal(SlowBuffer.prototype.offset, undefined); - - -} -- 2.34.1