From 0baf009b39c75dbc604800b9bd4c9f017a87d763 Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Fri, 24 Jun 2011 23:02:25 +0200 Subject: [PATCH] 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. --- test/testtable.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/testtable.js b/test/testtable.js index f51b0fda0..daf64503e 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]; }; }