Skip to content

Commit 63376da

Browse files
committed
Swift: Add tests for LogicalOperaion.qll.
1 parent c72377c commit 63376da

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

swift/ql/test/library-tests/elements/expr/logicaloperation/logicaloperation.expected

Whitespace-only changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import swift
2+
3+
string describe(LogicalOperation e) {
4+
(e instanceof BinaryLogicalOperation and result = "BinaryLogicalExpr") or
5+
(e instanceof LogicalAndExpr and result = "LogicalAndExpr") or
6+
(e instanceof LogicalOrExpr and result = "LogicalOrExpr") or
7+
(e instanceof UnaryLogicalOperation and result = "UnaryLogicalOperation") or
8+
(e instanceof NotExpr and result = "NotExpr")
9+
}
10+
11+
from LogicalOperation e
12+
select e, concat(describe(e), ", ")
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
func test(a: Bool, b: Bool, c: Bool) {
3+
// logical operations
4+
if (a && b) {}
5+
if (a || b) {}
6+
if (!a) {}
7+
if (!((a && b) || c)) {}
8+
}

0 commit comments

Comments
 (0)