From 5c2a145bdf90fe7d393ad18e9946c1c36b0f55bb Mon Sep 17 00:00:00 2001 From: Gabriel Wicke Date: Mon, 28 Nov 2011 11:19:50 +0000 Subject: [PATCH] Add diff output as well. --- tests/parser/parserTests.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/parser/parserTests.js b/tests/parser/parserTests.js index 5e98e1fd54..5527f70311 100644 --- a/tests/parser/parserTests.js +++ b/tests/parser/parserTests.js @@ -15,6 +15,7 @@ var fs = require('fs'), path = require('path'), + jsDiff = require('diff'), HTML5 = require('html5').HTML5; // @fixme wrap more or this setup in a common module @@ -199,11 +200,19 @@ function processTest(item) { console.log('RAW RENDERED:'); console.log(formatHTML(out) + "\n"); + var a = formatHTML(normalizeHTML( item.result )); + console.log('NORMALIZED EXPECTED:'); - console.log(formatHTML(normalizeHTML( item.result )) + "\n"); + console.log(a + "\n"); + + var b = formatHTML(normalizeOut( out )); console.log('NORMALIZED RENDERED:') console.log(formatHTML(normalizeOut(out)) + "\n"); + var patch = jsDiff.createPatch('wikitext.txt', a, b, 'before', 'after'); + + console.log('DIFF:'); + console.log(patch.replace(/^[^\n]*\n[^\n]*\n/, '')); } } }