Skip to content

Commit 3a13759

Browse files
committed
Swift: Clean up the test.
1 parent 17dd119 commit 3a13759

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

swift/ql/test/query-tests/Security/CWE-089/other.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class MyDatabase {
3535
func query(sqlStatement: String) { }
3636
func query(sqliteStatement: String) { }
3737

38-
// non-examples
38+
// non-examples
3939
func doSomething(sqlIndex: Int) { }
4040
func doSomething(sqliteContext: Sql) { }
4141
}
@@ -45,8 +45,8 @@ class MyDatabase {
4545
func test_heuristic(db: MyDatabase) throws {
4646
let remoteString = try String(contentsOf: URL(string: "http://example.com/")!)
4747

48-
_ = MyDatabase()
49-
_ = MyDatabase(sql: "some_fixed_sql")
48+
_ = MyDatabase() // GOOD
49+
_ = MyDatabase(sql: "some_fixed_sql") // GOOD
5050
_ = MyDatabase(sql: remoteString) // BAD
5151

5252
db.execute1(remoteString) // BAD
@@ -59,6 +59,6 @@ func test_heuristic(db: MyDatabase) throws {
5959
db.query(sqlStatement: remoteString) // BAD [NOT DETECTED]
6060
db.query(sqliteStatement: remoteString) // BAD [NOT DETECTED]
6161

62-
db.doSomething(sqlIndex: Int(remoteString) ?? 0)
63-
db.doSomething(sqliteContext: remoteString as! Sql)
62+
db.doSomething(sqlIndex: Int(remoteString) ?? 0) // GOOD
63+
db.doSomething(sqliteContext: remoteString as! Sql) // GOOD
6464
}

0 commit comments

Comments
 (0)