[Pkg-javascript-commits] [node-jsonstream] 82/214: make test easily configurable
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 1 12:58:43 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-jsonstream.
commit d4bc612df6cf785934ec3d0c03d8721b0911a80d
Author: Dominic Tarr <dominic.tarr at gmail.com>
Date: Sun Mar 17 18:38:00 2013 +1300
make test easily configurable
---
test/gen.js | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/test/gen.js b/test/gen.js
index 82387af..be72f36 100644
--- a/test/gen.js
+++ b/test/gen.js
@@ -1,7 +1,7 @@
var fs = require('fs')
var JSONStream = require('../')
var file = '/tmp/JSONStream-test-large.json'
-
+var size = 100000
if(process.title != 'browser')
require('tape')('out of mem', function (t) {
@@ -65,7 +65,7 @@ var generateTestData = function (cb) {
});
var i = 0;
- var max = 100000;
+ var max = size;
var writing = false
var split = ',\n';
var doc = randomJsonDoc();
@@ -75,6 +75,8 @@ var generateTestData = function (cb) {
if(writing) return
writing = true
while(++i < max) {
+ if(Math.random() < 0.001)
+ console.log('generate..', i + ' / ' + size)
if(!stream.write(doc + split)) {
writing = false
return stream.once('drain', write)
@@ -109,7 +111,7 @@ var testJSONStreamParse_causesOutOfMem = function (done) {
});
stream.on('end', function () {
- t.equal(items, 100000)
+ t.equal(items, size)
t.end()
});
@@ -121,7 +123,7 @@ var testJSONStreamParse_causesOutOfMem = function (done) {
fs.stat(file, function (err, stat) {
console.log(stat)
- if(err || stat.size !== 86000000)
+ if(err)
generateTestData(testJSONStreamParse_causesOutOfMem);
else
testJSONStreamParse_causesOutOfMem()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-jsonstream.git
More information about the Pkg-javascript-commits
mailing list