From b5e4334df557d62ee344b33d74130a03a021c9d9 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Wed, 11 Jul 2012 21:49:46 -0400 Subject: [PATCH] Ignore whitespace differences in test results, and provide more readable output upon data mismatch --- .../tools/testTranslators/translatorTester.js | 180 +++++++++++------- 1 file changed, 112 insertions(+), 68 deletions(-) diff --git a/chrome/content/zotero/tools/testTranslators/translatorTester.js b/chrome/content/zotero/tools/testTranslators/translatorTester.js index 8a76533409..1675b67e5f 100644 --- a/chrome/content/zotero/tools/testTranslators/translatorTester.js +++ b/chrome/content/zotero/tools/testTranslators/translatorTester.js @@ -506,6 +506,11 @@ Zotero_TranslatorTester.prototype._checkResult = function(test, translate, retur var translatedItem = Zotero_TranslatorTester._sanitizeItem(translate.newItems[i]); if(!this._compare(testItem, translatedItem)) { + // Show diff + this._debug(this, "Data mismatch detected:"); + this._debug(this, this._generateDiff(testItem, translatedItem)); + + // Save items. This makes it easier to correct tests automatically. var m = translate.newItems.length; test.itemsReturned = new Array(m); for(var j=0; j