]> zoso.dev Git - buffer.git/commitdiff
don't run "iojs buffer iterator" test in browsers
authorFeross Aboukhadijeh <feross@feross.org>
Tue, 10 Feb 2015 08:46:46 +0000 (00:46 -0800)
committerFeross Aboukhadijeh <feross@feross.org>
Tue, 10 Feb 2015 08:46:46 +0000 (00:46 -0800)
most don't support iterators

bin/download-node-tests.js
package.json
test/es6/README.txt [new file with mode: 0644]
test/es6/test-buffer-iterator.js [moved from test/node-test-buffer-iterator.js with 96% similarity]
test/node/README.txt [new file with mode: 0644]
test/node/test-buffer-ascii.js [moved from test/node-test-buffer-ascii.js with 96% similarity]
test/node/test-buffer-big.js [moved from test/node-test-buffer-big.js with 93% similarity]
test/node/test-buffer-concat.js [moved from test/node-test-buffer-concat.js with 94% similarity]
test/node/test-buffer-inspect.js [moved from test/node-test-buffer-inspect.js with 91% similarity]
test/node/test-buffer-slice.js [moved from test/node-test-buffer-slice.js with 82% similarity]
test/node/test-buffer.js [moved from test/node-test-buffer.js with 99% similarity]

index b5a854cc4634d20a526576151d4fc893be650992..c7e14d664d0e50dd83ec6fecae1f6c58d82a04e1 100755 (executable)
@@ -34,10 +34,16 @@ function downloadBufferTests (dir, files) {
   files.forEach(function (file) {
     if (!/test-buffer.*/.test(file.name)) return
 
+    var path
+    if (file.name !== 'test-buffer-iterator.js')
+      path = __dirname + '/../test/node/' + file.name
+    else
+      path = __dirname + '/../test/es6/' + file.name
+
     hyperquest(file.download_url, httpOpts)
       .pipe(split())
       .pipe(testfixer(file.name))
-      .pipe(fs.createWriteStream(__dirname + '/../test/node-' + file.name))
+      .pipe(fs.createWriteStream(path))
   })
 }
 
@@ -48,19 +54,8 @@ function testfixer (filename) {
     line = line.toString()
 
     if (firstline) {
-      var originalLine = line
       // require buffer explicitly
-      line = 'var Buffer = require(\'../\').Buffer\n'
-
-      // don't run this test for the Object-based bufer implementation because
-      // it doesn't have an Iterable interface (but these old browsers won't have it
-      // anyway)
-      if (filename === 'test-buffer-iterator.js')
-        line += 'if (process.env.OBJECT_IMPL) return\n'
-      else
-        line += 'if (process.env.OBJECT_IMPL) Buffer.TYPED_ARRAY_SUPPORT = false\n'
-
-      line += originalLine
+      line = 'var Buffer = require(\'../../\').Buffer\nif (process.env.OBJECT_IMPL) Buffer.TYPED_ARRAY_SUPPORT = false\n' + line
       firstline = false
     }
 
@@ -68,7 +63,7 @@ function testfixer (filename) {
     line = line.replace(/(var common = require.*)/, '// $1')
 
     // require browser buffer
-    line = line.replace(/(.*)require\('buffer'\)(.*)/, '$1require(\'../\')$2')
+    line = line.replace(/(.*)require\('buffer'\)(.*)/, '$1require(\'../../\')$2')
 
     // smalloc is only used for kMaxLength
     line = line.replace(/require\('smalloc'\)/, '{ kMaxLength: 0x3FFFFFFF }')
index a362d88649ce7d4bb87b4e2141d37981ef4e2db0..724c3bf0f8225f5f26e1a8a2d8a6436354ca0b57 100644 (file)
   },
   "scripts": {
     "test": "standard && node ./bin/test.js",
-    "test-browser": "zuul -- test/*.js",
-    "test-browser-local": "zuul --local -- test/*.js",
-    "test-node": "tape test/*.js && OBJECT_IMPL=true tape test/*.js",
+    "test-browser": "zuul -- test/*.js test/node/*.js",
+    "test-browser-local": "zuul --local -- test/*.js test/node/*.js",
+    "test-node": "tape test/*.js test/node/*.js test/es6/*.js && OBJECT_IMPL=true tape test/*.js test/node/*.js",
     "perf": "browserify --debug perf/bracket-notation.js > perf/bundle.js && open perf/index.html",
     "perf-node": "node perf/bracket-notation.js && node perf/concat.js && node perf/copy-big.js && node perf/copy.js && node perf/new-big.js && node perf/new.js && node perf/readDoubleBE.js && node perf/readFloatBE.js && node perf/readUInt32LE.js && node perf/slice.js && node perf/writeFloatBE.js",
     "size": "browserify -r ./ | uglifyjs -c -m | gzip | wc -c"
   },
   "standard": {
     "ignore": [
-      "test/node-*",
-      "perf/*"
+      "test/node/*.js",
+      "test/es6/*.js",
+      "perf/*.js"
     ]
   },
   "testling": {
diff --git a/test/es6/README.txt b/test/es6/README.txt
new file mode 100644 (file)
index 0000000..933dd6f
--- /dev/null
@@ -0,0 +1 @@
+io.js/node.js core buffer tests that require ES6 (for..of construct)
similarity index 96%
rename from test/node-test-buffer-iterator.js
rename to test/es6/test-buffer-iterator.js
index 972c7c6c8a6bc890e19808ca88229d41b8dd4058..1bbe1c740c102332894551836fbf5d218d88701b 100644 (file)
@@ -1,4 +1,4 @@
-var Buffer = require('../').Buffer
+var Buffer = require('../../').Buffer
 if (process.env.OBJECT_IMPL) return
 // var common = require('../common');
 var assert = require('assert');
diff --git a/test/node/README.txt b/test/node/README.txt
new file mode 100644 (file)
index 0000000..adf7087
--- /dev/null
@@ -0,0 +1 @@
+io.js/node.js core buffer tests
similarity index 96%
rename from test/node-test-buffer-ascii.js
rename to test/node/test-buffer-ascii.js
index e3d918ca1fb5e84be9e84144f48be87b9291f614..16572b39bc8d10bb67282c39e842dd5038189050 100644 (file)
@@ -1,4 +1,4 @@
-var Buffer = require('../').Buffer
+var Buffer = require('../../').Buffer
 if (process.env.OBJECT_IMPL) Buffer.TYPED_ARRAY_SUPPORT = false
 // var common = require('../common');
 var assert = require('assert');
@@ -24,4 +24,3 @@ for (var i = 0; i < expected.length; ++i) {
   if (input.charCodeAt(i) > 65535) ++i;
   if (input.charCodeAt(i) > 127) ++i;
 }
-
similarity index 93%
rename from test/node-test-buffer-big.js
rename to test/node/test-buffer-big.js
index a5558d5f77775a6daec69688ffd1fc05b7cda84d..d704cf95c8289d84dc32f029ca5c302f4945944a 100644 (file)
@@ -1,4 +1,4 @@
-var Buffer = require('../').Buffer
+var Buffer = require('../../').Buffer
 if (process.env.OBJECT_IMPL) Buffer.TYPED_ARRAY_SUPPORT = false
 // var common = require('../common');
 var assert = require('assert');
similarity index 94%
rename from test/node-test-buffer-concat.js
rename to test/node/test-buffer-concat.js
index d68b1354d64f37fa4aa56ff7de215ff7148bcad0..c703c144bf21b24b510c0d47b1266ab94be48c63 100644 (file)
@@ -1,4 +1,4 @@
-var Buffer = require('../').Buffer
+var Buffer = require('../../').Buffer
 if (process.env.OBJECT_IMPL) Buffer.TYPED_ARRAY_SUPPORT = false
 // var common = require('../common');
 var assert = require('assert');
similarity index 91%
rename from test/node-test-buffer-inspect.js
rename to test/node/test-buffer-inspect.js
index c35d416bd540e94400d7bd47e3e981e78930eaea..d8263a88f334a9b12b9acd2ae2749d07606efec9 100644 (file)
@@ -1,11 +1,11 @@
-var Buffer = require('../').Buffer
+var Buffer = require('../../').Buffer
 if (process.env.OBJECT_IMPL) Buffer.TYPED_ARRAY_SUPPORT = false
 // var common = require('../common');
 var assert = require('assert');
 
 var util = require('util');
 
-var buffer = require('../');
+var buffer = require('../../');
 
 buffer.INSPECT_MAX_BYTES = 2;
 
similarity index 82%
rename from test/node-test-buffer-slice.js
rename to test/node/test-buffer-slice.js
index ebef86e1c33f4004fe43ca4753c671b052cf523e..6e58812557a2d1316fee4e973f23ee3c76cdf35d 100644 (file)
@@ -1,9 +1,9 @@
-var Buffer = require('../').Buffer
+var Buffer = require('../../').Buffer
 if (process.env.OBJECT_IMPL) Buffer.TYPED_ARRAY_SUPPORT = false
 // var common = require('../common');
 var assert = require('assert');
 
-var Buffer = require('../').Buffer;
+var Buffer = require('../../').Buffer;
 
 var buff = new Buffer(Buffer.poolSize + 1);
 var slicedBuffer = buff.slice();
similarity index 99%
rename from test/node-test-buffer.js
rename to test/node/test-buffer.js
index ab4535daa29a28f4f6c703ce6064ab6d0e0dd17f..1a6a09df47b6f7ef916af9347259e6f611e40148 100644 (file)
@@ -1,10 +1,10 @@
-var Buffer = require('../').Buffer
+var Buffer = require('../../').Buffer
 if (process.env.OBJECT_IMPL) Buffer.TYPED_ARRAY_SUPPORT = false
 // var common = require('../common');
 var assert = require('assert');
 
-var Buffer = require('../').Buffer;
-var SlowBuffer = require('../').SlowBuffer;
+var Buffer = require('../../').Buffer;
+var SlowBuffer = require('../../').SlowBuffer;
 var smalloc = { kMaxLength: 0x3FFFFFFF };
 
 // counter to ensure unique value is always copied
@@ -1172,3 +1172,4 @@ assert.throws(function() {
 
 // Regression test for https://github.com/iojs/io.js/issues/649.
 assert.throws(function() { Buffer(1422561062959).toString('utf8'); });
+