oxc/crates/oxc_semantic/tests/integration/classes.rs
Boshen de75fb2942 refactor: compile less test binaries to speed up CI (#3414)
The semantic crate currently compiles 5 binaries for integration test, this PR merges them into one.
2024-05-26 07:21:44 +00:00

41 lines
730 B
Rust

use crate::util::SemanticTester;
#[test]
fn test_class_simple() {
SemanticTester::js(
"
class Foo {
#privateProperty = 1;
publicProperty = 2;
constructor() {} // this method is skip
a() {}
set b(v) {}
get b() {}
}
",
)
.has_class("Foo")
.has_number_of_elements(5)
.has_method("a")
.has_property("privateProperty");
}
#[test]
fn test_class_with_ts() {
SemanticTester::ts(
"
class Foo {
accessor ap = 1;
accessor #pap = 1;
constructor() {} // this method is skip
}
",
)
.has_class("Foo")
.has_number_of_elements(2)
.has_accessor("ap")
.has_accessor("pap");
}