[Pkg-javascript-commits] [node-expat] 11/371: test: add run stats
Jonas Smedegaard
dr at jones.dk
Sun Feb 28 09:59:40 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 ab65c9b03a104f4bc5ecc4579b46a3090a8ae2d0
Author: Astro <astro at spaceboyz.net>
Date: Sat May 22 15:45:41 2010 +0200
test: add run stats
---
test.js | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/test.js b/test.js
index c8d3ee8..88d9f33 100644
--- a/test.js
+++ b/test.js
@@ -19,8 +19,11 @@ function collapseTexts(evs) {
return r;
}
+var tests = 0, iterations = 0, fails = 0;
function expect(s, evs_expected) {
+ tests++;
for(var step = s.length; step > 0; step--) {
+ iterations++;
var evs_received = [];
var p = new expat.Parser();
p.addListener('startElement', function(name, attrs) {
@@ -41,9 +44,11 @@ function expect(s, evs_expected) {
var expected = JSON.stringify(evs_expected);
var received = JSON.stringify(collapseTexts(evs_received));
if (expected != received) {
+ fails++;
sys.puts("Fail for: " + s + " (step=" + step + ")");
sys.puts("Expected: " + expected);
sys.puts("Received: " + received);
+ return; // don't try with smaller step size
}
}
}
@@ -80,3 +85,5 @@ expect("<r>ß</r>",
[['startElement', 'r', {}],
['text', "ß"],
['endElement', 'r']]);
+
+sys.puts("Ran "+tests+" tests with "+iterations+" iterations: "+fails+" failures.");
--
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