mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
Swift: Add CFG test cases for #available.
This commit is contained in:
@@ -6325,3 +6325,26 @@ cfg.swift:
|
||||
|
||||
# 493| 13
|
||||
#-----| -> exit testIfConfig() (normal)
|
||||
|
||||
# 496| enter testAvailable()
|
||||
#-----| -> testAvailable()
|
||||
|
||||
# 496| testAvailable()
|
||||
#-----| -> x
|
||||
|
||||
# 497| var ... = ...
|
||||
#-----| -> x
|
||||
|
||||
# 497| x
|
||||
#-----| -> if ... then { ... }
|
||||
|
||||
# 497| x
|
||||
#-----| match -> 0
|
||||
|
||||
# 497| 0
|
||||
#-----| -> var ... = ...
|
||||
|
||||
# 499| if ... then { ... }
|
||||
#-----| -> StmtCondition
|
||||
|
||||
# 499| StmtCondition
|
||||
|
||||
@@ -492,3 +492,29 @@ func testIfConfig() {
|
||||
|
||||
13
|
||||
}
|
||||
|
||||
func testAvailable() -> Int {
|
||||
var x = 0;
|
||||
|
||||
if #available(macOS 10, *) {
|
||||
x += 1
|
||||
}
|
||||
|
||||
if #available(macOS 10.13, *) {
|
||||
x += 1
|
||||
}
|
||||
|
||||
if #unavailable(iOS 10, watchOS 10, macOS 10) {
|
||||
x += 1
|
||||
}
|
||||
|
||||
guard #available(macOS 12, *) else {
|
||||
x += 1
|
||||
}
|
||||
|
||||
if #available(macOS 12, *), #available(iOS 12, *) {
|
||||
x += 1
|
||||
}
|
||||
|
||||
return x
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user