Skip to content

Commit a1d83ae

Browse files
committed
unified: Add basic test
1 parent 9fd7478 commit a1d83ae

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| test.swift:2:9:2:9 | a | Unused local variable 'a' |
2+
| test.swift:12:9:12:9 | a | Unused local variable 'a' |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
query: queries/unusedentities/UnusedVariable.ql
2+
postprocess: utils/test/InlineExpectationsTestQuery.ql
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
func t1() -> Int {
2+
let a = 1 // $ Alert[unified/unused-variable]
3+
let b = 2
4+
return b
5+
}
6+
7+
func t2() -> Int {
8+
func foo(callback: (Int) -> Void) -> String {
9+
callback()
10+
return "df"
11+
}
12+
// Note: This currently fails because the trailing closure is not extracted correctly
13+
let a = 1 // $ SPURIOUS: Alert
14+
print(foo() { _ in
15+
print(a)
16+
let b = 2 // $ MISSING: Alert[unified/unused-variable]
17+
})
18+
}

0 commit comments

Comments
 (0)