adding the expect_exact clause, which instead of parsing code will just read a string for expects, making it suitable for testing OutputStream
This commit is contained in:
parent
e04ef56243
commit
516298fa5f
|
|
@ -84,7 +84,12 @@ function run_compress_tests() {
|
||||||
warnings: false
|
warnings: false
|
||||||
});
|
});
|
||||||
var cmp = new U.Compressor(options, true);
|
var cmp = new U.Compressor(options, true);
|
||||||
var expect = make_code(as_toplevel(test.expect), false);
|
var expect
|
||||||
|
if (test.expect) {
|
||||||
|
expect = make_code(as_toplevel(test.expect), false);
|
||||||
|
} else {
|
||||||
|
expect = test.expect_exact;
|
||||||
|
}
|
||||||
var input = as_toplevel(test.input);
|
var input = as_toplevel(test.input);
|
||||||
var input_code = make_code(test.input);
|
var input_code = make_code(test.input);
|
||||||
var output = input.transform(cmp);
|
var output = input.transform(cmp);
|
||||||
|
|
@ -150,7 +155,7 @@ function parse_test(file) {
|
||||||
}
|
}
|
||||||
if (node instanceof U.AST_LabeledStatement) {
|
if (node instanceof U.AST_LabeledStatement) {
|
||||||
assert.ok(
|
assert.ok(
|
||||||
node.label.name == "input" || node.label.name == "expect",
|
node.label.name == "input" || node.label.name == "expect" || node.label.name == "expect_exact",
|
||||||
tmpl("Unsupported label {name} [{line},{col}]", {
|
tmpl("Unsupported label {name} [{line},{col}]", {
|
||||||
name: node.label.name,
|
name: node.label.name,
|
||||||
line: node.label.start.line,
|
line: node.label.start.line,
|
||||||
|
|
@ -162,7 +167,11 @@ function parse_test(file) {
|
||||||
if (stat.body.length == 1) stat = stat.body[0];
|
if (stat.body.length == 1) stat = stat.body[0];
|
||||||
else if (stat.body.length == 0) stat = new U.AST_EmptyStatement();
|
else if (stat.body.length == 0) stat = new U.AST_EmptyStatement();
|
||||||
}
|
}
|
||||||
|
if (node.label.name === "expect_exact") {
|
||||||
|
test[node.label.name] = stat.body.start.value
|
||||||
|
} else {
|
||||||
test[node.label.name] = stat;
|
test[node.label.name] = stat;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user