[Pkg-javascript-commits] [node-jsonstream] 19/214: test expected values more exaustively, error on count = 0
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 1 12:58:33 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 c3292a75de5fc197b49001ad9d1059decfe3fff9
Author: James Halliday <mail at substack.net>
Date: Wed Feb 22 11:24:49 2012 -0800
test expected values more exaustively, error on count = 0
---
test/stringify_object.js | 45 ++++++++++++++++++++++++---------------------
1 file changed, 24 insertions(+), 21 deletions(-)
diff --git a/test/stringify_object.js b/test/stringify_object.js
index b0de472..cb727b0 100644
--- a/test/stringify_object.js
+++ b/test/stringify_object.js
@@ -4,6 +4,9 @@ var fs = require ('fs')
, file = join(__dirname, 'fixtures','all_npm.json')
, JSONStream = require('../')
, it = require('it-is').style('colour')
+ , es = require('event-stream')
+ , pending = 10
+ , passed = true
function randomObj () {
return (
@@ -18,26 +21,26 @@ var fs = require ('fs')
)
}
-var expected = {}
- , stringify = JSONStream.stringifyObject()
- , es = require('event-stream')
- , stringified = ''
- , called = 0
- , count = 10
- , ended = false
-
-es.connect(
- stringify,
- es.writeArray(function (err, lines) {
- it(JSON.parse(lines.join(''))).deepEqual(expected)
- console.error('PASSED')
- })
-)
+for (var ix = 0; ix < pending; ix++) (function (count) {
+ var expected = {}
+ , stringify = JSONStream.stringifyObject()
+
+ es.connect(
+ stringify,
+ es.writeArray(function (err, lines) {
+ it(JSON.parse(lines.join(''))).deepEqual(expected)
+console.log(pending);
+ if (--pending === 0) {
+ console.error('PASSED')
+ }
+ })
+ )
-while (count --) {
- var key = Math.random().toString(16).slice(2)
- expected[key] = randomObj()
- stringify.write([ key, expected[key] ])
-}
+ while (count --) {
+ var key = Math.random().toString(16).slice(2)
+ expected[key] = randomObj()
+ stringify.write([ key, expected[key] ])
+ }
-stringify.end()
+ stringify.end()
+})(ix)
--
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