-
-
Notifications
You must be signed in to change notification settings - Fork 349
/
testbrowser.html
37 lines (33 loc) · 880 Bytes
/
testbrowser.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>mvdan-sh</title>
</head>
<body>
<script>
var sh = "mock-sh";
</script>
<script src="./index.js"></script>
<script>
const assert = {
equal(x, y) {
if (x !== y) {
throw new Error("assert error");
}
},
};
assert.equal(!sh, false);
const syntax = sh.syntax;
const parser = syntax.NewParser();
const printer = syntax.NewPrinter();
const src = "echo 'foo'";
const f = parser.Parse(src, "src");
const out = printer.Print(f);
assert.equal(out, "echo 'foo'\n");
assert.equal(sh, (window.newSh = sh.noConflict()));
assert.equal(sh, "mock-sh");
</script>
</body>
</html>