mirror of
https://github.com/github/codeql.git
synced 2026-04-25 00:35:20 +02:00
Swift: Add tests for LogicalOperaion.qll.
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import swift
|
||||
|
||||
string describe(LogicalOperation e) {
|
||||
(e instanceof BinaryLogicalOperation and result = "BinaryLogicalExpr") or
|
||||
(e instanceof LogicalAndExpr and result = "LogicalAndExpr") or
|
||||
(e instanceof LogicalOrExpr and result = "LogicalOrExpr") or
|
||||
(e instanceof UnaryLogicalOperation and result = "UnaryLogicalOperation") or
|
||||
(e instanceof NotExpr and result = "NotExpr")
|
||||
}
|
||||
|
||||
from LogicalOperation e
|
||||
select e, concat(describe(e), ", ")
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
func test(a: Bool, b: Bool, c: Bool) {
|
||||
// logical operations
|
||||
if (a && b) {}
|
||||
if (a || b) {}
|
||||
if (!a) {}
|
||||
if (!((a && b) || c)) {}
|
||||
}
|
||||
Reference in New Issue
Block a user