Skip to content

Commit 3f510d3

Browse files
Moving test_src to interactive-tests folder.
1 parent b59c949 commit 3f510d3

File tree

5 files changed

+69
-5
lines changed

5 files changed

+69
-5
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// A very simple logging facility, used in test/xpath.html.
77
import {
88
xmlEscapeText
9-
} from "../src/dom/util.js"
9+
} from "../../src/dom/util.js"
1010

1111

1212
export class Log {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
} from "../tests_src/xpath_unittest.js"
1919
import {
2020
parseTree
21-
} from "../src/xpathdebug.js"
21+
} from "../../src/xpathdebug.js"
2222

2323
window.logging = true;
2424
window.xpathdebug = true;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
// Author: Steffen Meschkat <mesch@google.com>
1010
import {
1111
xmlParse
12-
} from "../src/dom"
12+
} from "../../src/dom"
1313
import {
1414
xsltProcess
15-
} from "../src/xslt"
15+
} from "../../src/xslt"
1616

1717
window.logging = true;
1818
window.xsltdebug = true;

interactive-tests/xpath.html

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,69 @@
77
<select id="s" multiple="1" size="30" name="cases"></select>
88
<input type="submit" value="parse" align="top"/>
99
</form>
10+
<script type="application/javascript" src="https://www.unpkg.com/xslt-processor@1.0.0/xslt-processor.js"></script>
11+
<script>
12+
// Copyright 2023 Design Liquido
13+
// Copyright 2018 Johannes Wilm
14+
// Copyright 2005 Google Inc.
15+
// All Rights Reserved
16+
//
17+
// Tests for the XPath parser. To run the test, open the file from the
18+
// file system. No server support is required.
19+
//
20+
//
21+
// Author: Steffen Meschkat <mesch@google.com>
22+
import {
23+
Log
24+
} from "./simplelog.js"
25+
import {
26+
xpathParse
27+
} from "../src/xpath.js"
28+
import {
29+
expr
30+
} from "../tests_src/xpath_unittest.js"
31+
import {
32+
parseTree
33+
} from "../src/xpathdebug.js"
34+
35+
window.logging = true;
36+
window.xpathdebug = true;
37+
38+
window.load_expr = () => {
39+
const s = document.getElementById('s');
40+
for (let i = 0; i < expr.length; ++i) {
41+
const o = new Option(expr[i].replace(/&gt;/, '>').replace(/&lt;/, '<'));
42+
s.options[s.options.length] = o;
43+
}
44+
s.selectedIndex = 0;
45+
}
46+
47+
let log = new Log()
48+
49+
window.xpath_test = form => {
50+
log.clear();
51+
try {
52+
const i = form.cases.selectedIndex;
53+
const options = form.cases.options;
54+
55+
const text = options[i].value;
56+
log.writeRaw(`<tt><b>${text}</b></tt>`);
57+
58+
const expr = xpathParse(text, message => log.write(message));
59+
log.writeRaw(`<tt><b>${text}</b></tt>`);
60+
log.writeRaw(`<pre>${parseTree(expr, '')}</pre>`);
61+
62+
options[i].selected = false;
63+
if (i < options.length - 1) {
64+
options[i + 1].selected = true;
65+
} else {
66+
options[0].selected = true;
67+
}
68+
69+
} catch (e) {
70+
log.write(`EXCEPTION ${e}`);
71+
}
72+
}
73+
</script>
1074
</body>
1175
</html>

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"jest.config.ts",
1919
"rollup.config.js",
2020
"dist/**/*",
21-
"test_src/**/*",
21+
"interactive-tests/js/**/*",
2222
"tests/**/*"
2323
]
2424
}

0 commit comments

Comments
 (0)