You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But I kind of think the SemanticTester might not be that intuitive for testing general scope resolving logic, which means weather the symbol has correct scope and don't care about the flags or others.
the x in #x is the ScopeId we get from the Sematics.
In this way, we could easily visualize the whether the scope is correct. And with snapshot testing, this could be a general way for testing without any other kinds of assertions.
Intresting. I think it's hard to cover all cases by manually writing test cases, the general approach should be running Test262 over mangled files ... let me think about this.
oxc/crates/oxc_semantic/tests/util/mod.rs
Lines 15 to 19 in 9aa78f6
The current
SemanticTester
is great to do many kinds of assertions. Such asoxc/crates/oxc_semantic/tests/symbols.rs
Lines 8 to 13 in 9aa78f6
But I kind of think the
SemanticTester
might not be that intuitive for testing general scope resolving logic, which means weather the symbol has correct scope and don't care about the flags or others.Let's see we have test case
we could transform it to
the
x
in#x
is theScopeId
we get from theSematics
.In this way, we could easily visualize the whether the scope is correct. And with snapshot testing, this could be a general way for testing without any other kinds of assertions.
I get this idea from contributing to swc. https://github.com/swc-project/swc/blob/main/crates/swc_ecma_transforms_base/tests/resolver/hoisting/output.js
The text was updated successfully, but these errors were encountered: