-
Notifications
You must be signed in to change notification settings - Fork 25
[TS] Extend reachability analysis test suite #334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
c1222a1
to
8ed53e5
Compare
} | ||
val arg = resolve(expr.args.single()) ?: return null | ||
|
||
when (arg.sort) { |
Check warning
Code scanning / detekt
Braces do not comply with the specified policy Warning
.single { it.name == "callbackReachable" } | ||
|
||
val initialTarget = TsReachabilityTarget.InitialPoint(method.cfg.stmts.first()) | ||
var target: TsTarget = initialTarget |
Check warning
Code scanning / detekt
Var declaration could be val. Warning test
@Test | ||
fun testInstanceofInheritanceReachable() { | ||
// Test reachability through type-specific method call: | ||
// const obj = new ConcreteA(value) -> const specificResult = obj.specificMethodA() -> if (specificResult === 1) -> return 1 |
Check warning
Code scanning / detekt
Line detected, which is longer than the defined maximum line length in the code style. Warning test
target.addChild(TsReachabilityTarget.FinalPoint(returnStmt)) | ||
|
||
val results = machine.analyze(listOf(method), listOf(initialTarget)) | ||
|
Check warning
Code scanning / detekt
Detects trailing spaces Warning test
@Test | ||
fun testMutualRecursionReachable() { | ||
// Test reachability through mutual recursion with depth limits: | ||
// if (input > 0 && input < 5) -> const evenResult = this.isEven(input) -> if (evenResult && input === 4) -> return 1 |
Check warning
Code scanning / detekt
Line detected, which is longer than the defined maximum line length in the code style. Warning test
@Test | ||
fun testComplexTypeGuardReachable() { | ||
// Test reachability through complex type guard combination: | ||
// if (typeof value === "object" && value !== null) -> if (value instanceof Date) -> if (value.getFullYear() > 2020) -> return 1 |
Check warning
Code scanning / detekt
Line detected, which is longer than the defined maximum line length in the code style. Warning test
8ed53e5
to
35221de
Compare
35221de
to
b3a41e1
Compare
This PR adds a comprehensive test suite for reachability analysis in TypeScript programs.