Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions src/main/webapp/diffview.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
body {
font-family: "Arial";
font-size: 10px;
overflow-y: scroll;
}
body.default {
background: url("images/body.gif") repeat-x #a8b8c8;
color: #000;
}
body.default button {
background: #dfd;
border-color: #030;
box-shadow: 0px 0.1em 0.2em rgba(0, 32, 0, 0.75);
color: #030;
}
.default a {
color: #f00;
}
Expand Down Expand Up @@ -2038,7 +2023,7 @@ table.diff tbody td {
letter-spacing: 0.1em;
padding: 0.5em 0.5em 0px;
vertical-align: top;
white-space: pre;
white-space: pre-wrap;
}
table.diff tbody td em {
font-style: normal;
Expand Down
49 changes: 26 additions & 23 deletions src/main/webapp/expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,38 +65,41 @@ function prettyPrint(input) {

function match (stacktrace) {
var patterns = [
/^[a-zA-Z]+[.][a-zA-Z]+[.][a-zA-Z]+:[\s\S]+expected:<([\s\S]*)>[\s\S]+but[\s\S]+was:<([\s\S]*)>/,
/^[a-zA-Z]+[.][a-zA-Z]+[.][a-zA-Z]+:[\s\S]+expected[\s\S]+same:<([\s\S]*)>[\s\S]+was[\s\S]+not:<([\s\S]*)>/,
/^[a-zA-Z]+[.][a-zA-Z]+[.][a-zA-Z]+:[\s\S]+Expected:[\s\S]+is[\s\S]+<([\s\S]*)>[\s\S]+got:[\s\S]*<([\s\S]*)>/,
/^[a-zA-Z]+[.][a-zA-Z]+[.][a-zA-Z]+:[\s\S]+Expected:[\s\S]+<([\s\S]*)>[\s\S]+got:[\s\S]*<([\s\S]*)>/,
/^[a-zA-Z]+[.][a-zA-Z]+[.][a-zA-Z]+:[\s\S]+expected[\s\S]+same[\s\S]+instance[\s\S]+but[\s\S]+found:<([\s\S]*)>[\s\S]+and:[\s\S]*<([\s\S]*)>/
];
for (i=0; i<patterns.length; i++)
{
/expected:[\s]*<([\s\S]*)>[\s]+but[\s]+was:[\s]*<([\s\S]*)>/, // JUnit assertEquals
/Expected:[\s]*"([\s\S]*)"[\s]+but:[\s]was[\s]+"([\s\S]*)"/, // Hamcrest
/Expecting:[\s]*<"([\s\S]*)">[\s]+to be equal to:[\s]+<"([\s\S]*)">[\s]+but was not/ // AssertJ
];
for (i=0; i<patterns.length; i++) {
var matched = stacktrace.match(patterns[i]);
if (matched != null)
return matched;
}
}
return null;
}

function diffUsingJS () {
var stacktraceHeader = dojo.filter(dojo.query("h3"), function(header){ return header.innerHTML == 'Stacktrace'; })[0];

var stacktrace = stacktraceHeader.nextSibling.innerHTML;
if(stacktrace != undefined) {
var matched = match(stacktrace);
var preNodes = dojo.query("#main-panel > pre");

if (preNodes.length > 0) {
var matched;
if (preNodes[1]) { // error message + stacktrace
matched = match(preNodes[1].textContent);
}
if (!matched) { // only error message
matched = match(preNodes[0].textContent);
}
if (matched != null) {
var expected = matched[1];
var actual = matched[2];
var diffoutputdiv = $("diffoutput");
while (diffoutputdiv.firstChild) diffoutputdiv.removeChild(diffoutputdiv.firstChild);
var expected = matched[1];
var actual = matched[2];
var diffoutputdiv = $("diffoutput");
while (diffoutputdiv.firstChild)
diffoutputdiv.removeChild(diffoutputdiv.firstChild);

var exp = prettyPrint(expected);
var act = prettyPrint(actual);
var output = prettydiff(apiParams(exp, act));
dojo.place(output[0],diffoutputdiv);
}
var exp = prettyPrint(expected).replace(/\r?\n/g, "<br/>\n");
var act = prettyPrint(actual).replace(/\r?\n/g, "<br/>\n");
var output = prettydiff(apiParams(exp, act));
dojo.place(output[0], diffoutputdiv);
}
}
}
dojo.addOnLoad(function() {
Expand Down