summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2011-06-24 23:02:25 +0200
committerAndrea Canciani <ranma42@gmail.com>2011-06-25 10:19:36 +0200
commit0baf009b39c75dbc604800b9bd4c9f017a87d763 (patch)
tree6ce204e63c5f3ff4382daeba07961ccaa212b350
parenta447e949799000760835beeafd2d45c76580fb9e (diff)
test: Make parsing of log files more solid
The old code considered every even "word" as a key and every odd "word" as a value when parsing a test log file. All of the keys end with ':', so restrict with this requirement.
-rw-r--r--test/testtable.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/testtable.js b/test/testtable.js
index f51b0fda..daf64503 100644
--- a/test/testtable.js
+++ b/test/testtable.js
@@ -48,6 +48,7 @@ function resetGlobals () {
/* utility functions */
+function isKey (key) { return key[key.length-1] == ':'; }
function normalizeKey (key) { return key.toLowerCase ().replace (/[^a-z0-9]/, ""); }
function isVisible (x) { return x.style.display != "none"; }
@@ -293,7 +294,8 @@ function Test () {
this.addData = function (array) {
for (var i = 0; i < array.length - 1; i += 2)
- this[normalizeKey (array[i])] = array[i+1];
+ if (isKey (array[i]))
+ this[normalizeKey (array[i])] = array[i+1];
};
}