ulmul 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,132 +0,0 @@
1
- // get accurate timing.
2
- // This file must be loaded after prettify.js for this to work.
3
- PR_SHOULD_USE_CONTINUATION = false;
4
- var realIsIE6 = _pr_isIE6();
5
- if (!/\btestcopypaste\b/.test(location.fragment)) {
6
- _pr_isIE6 = function() { return false; }; // Ensure consistent output.
7
- }
8
-
9
- /**
10
- * @param golden a mapping from IDs of prettyprinted chunks to an abbreviated
11
- * form of the expected output. See "var goldens" in prettify_test.html
12
- * for an example.
13
- */
14
- function go(goldens) {
15
- startClock();
16
- prettyPrint(function () { stopClock(); runTests(goldens); });
17
- }
18
-
19
- function runTests(goldens) {
20
- /** number of characters in common at the end up to max. */
21
- function commonPrefix(a, b) {
22
- var n = Math.min(a.length, b.length);
23
- var i;
24
- for (i = 0; i < n; ++i) {
25
- if (a.charAt(i) !== b.charAt(i)) { break; }
26
- }
27
- return i;
28
- }
29
-
30
- /** number of characters in common at the end up to max. */
31
- function commonSuffix(a, b, max) {
32
- var n = Math.min(a.length - max, b.length - max);
33
- var i;
34
- for (i = 0; i < n; ++i) {
35
- if (a.charAt(a.length - i - 1) !== b.charAt(b.length - i - 1)) { break; }
36
- }
37
- return i;
38
- }
39
-
40
- /** convert a plain text string to html by escaping html special chars. */
41
- function html(plainText) {
42
- return plainText.replace(/\046/g, '&amp;')
43
- .replace(/\074/g, '&lt;')
44
- .replace(/\076/g, '&gt;')
45
- .replace(/\042/g, '&quot;')
46
- .replace(/\xa0/g, '&nbsp;');
47
- }
48
-
49
- /**
50
- * get normalized markup. innerHTML varies enough across browsers that we
51
- * can't use it.
52
- */
53
- function normalizedInnerHtml(node) {
54
- var out = [];
55
- for (var child = node.firstChild; child; child = child.nextSibling) {
56
- PR_normalizedHtml(child, out, true);
57
- }
58
- out = out.join('');
59
- // more normalization to work around problems with non-ascii chars in
60
- // regexps in Safari
61
- for (var i = 0; (i = out.indexOf('\xa0')) >= 0;) {
62
- out = out.substring(0, i) + '&nbsp;' + out.substring(i + 1);
63
- }
64
- return out;
65
- }
66
-
67
- var htmlOut = [];
68
- var failures = 0;
69
- document.getElementById('errorReport').innerHTML =
70
- '<h1>Running tests&hellip;<\/h1>';
71
- htmlOut.push('<h1>Test results<\/h1>');
72
- for (var lang in goldens) {
73
- var container = document.getElementById(lang);
74
- if (realIsIE6 && /\bknown_ie6_failure\b/.test(container.className)) {
75
- continue;
76
- }
77
- // Convert abbreviations that start with `.
78
- var golden = goldens[lang].replace(/`([A-Z]{3})/g, function (_, lbl) {
79
- return (lbl == 'END'
80
- ? '<\/span>'
81
- : '<span class="' + lbl.toLowerCase() + '">');
82
- })
83
- // Line numbers
84
- .replace(/`#(?![0-9])/, '<li class="L0">')
85
- .replace(/`#([0-9])/g, '</li><li class="L$1">');
86
- var actual = normalizedInnerHtml(container);
87
- if (golden !== actual) { // test failed
88
- // write out
89
- var pre = commonPrefix(golden, actual);
90
- var post = commonSuffix(golden, actual, pre);
91
-
92
- ++failures;
93
- htmlOut.push(
94
- '<h2><a href="#' + html(lang) + '">'
95
- + html(lang) + '<\/a> Failed<\/h2>');
96
- htmlOut.push(
97
- '<tt>' + html(golden.substring(0, pre)) +
98
- '&raquo;<span class="mismatch">' +
99
- html(golden.substring(pre, golden.length - post)) +
100
- '<\/span>&laquo;' +
101
- html(golden.substring(golden.length - post)) +
102
-
103
- '<br>!==<br>' +
104
-
105
- html(actual.substring(0, pre)) +
106
- '&raquo;<span class="mismatch">' +
107
- html(actual.substring(pre, actual.length - post)) +
108
- '<\/span>&laquo;' +
109
- html(actual.substring(actual.length - post)) + '<\/tt>');
110
- } else {
111
- htmlOut.push(
112
- '<h2><a href="#' + html(lang) + '">' + html(lang) + '<\/a> OK<\/h2>');
113
- }
114
- }
115
- var summary = (failures ? (failures + ' test(s) failed') : 'Tests Passed');
116
- htmlOut.push('<h2>' + summary + '<\/h2>');
117
- document.title += ' \u2014 ' + summary;
118
- document.getElementById('errorReport').innerHTML =
119
- htmlOut.join('').replace(/&lt;br&gt;/g, '&lt;br&gt;\n');
120
- }
121
-
122
- var startTime = null;
123
- function startClock() {
124
- startTime = (new Date).getTime();
125
- }
126
-
127
- function stopClock() {
128
- var delta = (new Date).getTime() - startTime;
129
- startTime = null;
130
- document.getElementById('timing').innerHTML = 'Took ' + delta + ' ms';
131
- }
132
-
@@ -1,5 +0,0 @@
1
- /* Used by error reporting code in test_base.js */
2
- .mismatch { background: #fee; font-weight: bold }
3
- span.annot { margin:2px 2px 2px 3em; border:1px dotted #88f; background:#eef;
4
- padding: 0 2px 0 2px }
5
- .nocode { background: #f8f8f8 }