[Pkg-javascript-commits] [node-expat] 79/371: test.js: repair start & stop test case

Jonas Smedegaard dr at jones.dk
Sun Feb 28 09:59:47 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository node-expat.

commit 3ce618e8bf1e9d2fa409c622d66b13b9a48707c1
Author: Astro <astro at spaceboyz.net>
Date:   Tue Jun 14 12:18:25 2011 +0200

    test.js: repair start & stop test case
---
 test.js | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/test.js b/test.js
index 8d3de5c..976839b 100644
--- a/test.js
+++ b/test.js
@@ -209,12 +209,7 @@ vows.describe('node-expat').addBatch({
 		// finished parsing
 		if(name == 'wrap') {
 		    // test elements received (count. naming, order)
-		    if(JSON.stringify(expected) != JSON.stringify(received)) {
-			sys.puts("Failed Stop/Resume test");
-			sys.puts("Expected: " + expected);
-			sys.puts("Received: " + received);
-			return cb(false);
-		    }
+		    assert.equal(JSON.stringify(received), JSON.stringify(expected));
 
 		    // test timing (+-5%)
 		    var now = new Date();
@@ -222,25 +217,17 @@ vows.describe('node-expat').addBatch({
 		    var max = expectedRuntime + expectedRuntime * tolerance,
 			min = expectedRuntime - expectedRuntime * tolerance;
 
-		    if(diff > max) {
-			sys.puts("Failed Stop/Resume test");
-			sys.puts("Expected Runtime < " + max);
-			sys.puts("Taken Runtime: " + diff);
-			return cb(false);
-		    }
-
-		    if(diff < min) {
-			sys.puts("Failed Stop/Resume test");
-			sys.puts("Expected Runtime > " + min);
-			sys.puts("Taken Runtime: " + diff);
-			return cb(false);
-		    }
+		    assert.ok(diff < max, 'Runtime within maximum expected time');
+		    assert.ok(diff > min, 'Runtime at least minimum expected time');
 
 		    return cb(true);
 		}
 	    });
 
 	    assert.ok(p.parse(input));
+	},
+	'should have worked': function() {
+	    assert.ok(true, 'start & stop works');
 	}
     },
     'corner cases': {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-expat.git



More information about the Pkg-javascript-commits mailing list