oxc/crates/oxc_semantic/tests/modules.rs
Don Isaac 38fb4c296a
test(semantic): test harness (#679)
A test harness for checking results of semantic analysis.

I got tired of writing ad-hoc test cases when finding bugs in semantic
analysis, so I made this.
2023-08-07 10:43:05 +08:00

33 lines
644 B
Rust

mod util;
#[allow(clippy::wildcard_imports)]
use util::*;
#[test]
fn test_exports() {
let test = SemanticTester::js(
"
function foo(a, b) {
let c = a + b;
return c / 2
}
export class ExportModifier {
constructor(x) {
this.x = x;
}
}
const defaultExport = 1;
export { foo };
export default defaultExport;
",
)
.with_module_record_builder(true);
test.has_some_symbol("foo").is_exported().test();
// FIXME: failing
// test.has_some_symbol("defaultExport").is_exported().test();
}