diff options
Diffstat (limited to 'tests/wpt/web-platform-tests/html/syntax/parsing/common.js')
m--------- | tests/wpt/web-platform-tests | 0 | ||||
-rw-r--r-- | tests/wpt/web-platform-tests/html/syntax/parsing/common.js | 24 |
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/wpt/web-platform-tests b/tests/wpt/web-platform-tests deleted file mode 160000 -Subproject 29dfb8944e535d439ca94cf7d1b1d9138a8ad11 diff --git a/tests/wpt/web-platform-tests/html/syntax/parsing/common.js b/tests/wpt/web-platform-tests/html/syntax/parsing/common.js new file mode 100644 index 00000000000..9c85650c3f4 --- /dev/null +++ b/tests/wpt/web-platform-tests/html/syntax/parsing/common.js @@ -0,0 +1,24 @@ +function mark_diffs(expected, actual) { + var expected_lines = expected.split("\n"); + var actual_lines = actual.split("\n"); + + var max_length = Math.max(expected_lines.length, actual_lines.length); + + var expected_diff = ["code", {}]; + var actual_diff = ["code", {}]; + + for (var i=0; i<max_length; i++) { + if (expected_lines[i] === actual_lines[i]) { + expected_diff.push(expected_lines[i] + "\n"); + actual_diff.push(actual_lines[i] + "\n"); + } else { + if (expected_lines[i]) { + expected_diff.push(["span", {style:"color:red"}, expected_lines[i] + "\n"]); + } + if (actual_lines[i]) { + actual_diff.push(["span", {style:"color:red"}, actual_lines[i] + "\n"]); + } + } + } + return [expected_diff, actual_diff]; +}
\ No newline at end of file |