Skip to content

Commit 3bf191f

Browse files
committed
unified: Add test
1 parent f8a5772 commit 3bf191f

3 files changed

Lines changed: 33 additions & 0 deletions

File tree

‎unified/ql/test/library-tests/mad/test.expected‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ isSink
1616
| test.swift:101:18:101:24 | fileURL | path-injection |
1717
| test.swift:107:23:107:34 | seedFilePath | path-injection |
1818
| test.swift:119:29:119:34 | string | path-injection |
19+
| test.swift:138:9:138:14 | string | shorthand-sink |
1920
isSource
2021
| test.swift:4:5:4:27 | String(...) | remote |
2122
| test.swift:5:5:5:44 | String(...) | remote |
@@ -25,3 +26,4 @@ isSource
2526
| test.swift:10:5:12:24 | String(...) | local |
2627
| test.swift:13:5:15:28 | String(...) | local |
2728
| test.swift:29:29:29:32 | text | local |
29+
| test.swift:130:11:130:11 | x | shorthand-source |
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
extensions:
2+
- addsTo:
3+
pack: codeql/unified-all
4+
extensible: legacySourceModel
5+
data: # namespace, type, subtypes, name, signature, ext, output, kind, provenance
6+
- ["", "ShorthandTest", true, "sourceParams(_:)", "", "", "Parameter[self,0]", "shorthand-source", "manual"]
7+
- addsTo:
8+
pack: codeql/unified-all
9+
extensible: legacySinkModel
10+
data: # namespace, type, subtypes, name, signature, ext, input, kind, provenance
11+
- ["", "ShorthandTest", true, "sinkArgs(_:)", "", "", "Argument[self,0]", "shorthand-sink", "manual"]

‎unified/ql/test/library-tests/mad/test.swift‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,23 @@ class Connection {
118118
func testConnectionLocation(string: String) {
119119
Connection.Location.uri(string, parameters: "") // $ isSink=path-injection
120120
}
121+
122+
class ShorthandTest {
123+
func sourceParams(_ x: String) {}
124+
125+
func sinkArgs(_ x: String) {}
126+
}
127+
128+
class ShorthandTestSub: ShorthandTest {
129+
override func sourceParams(
130+
_ x: String // $ isSource=shorthand-source
131+
) {
132+
_ = self
133+
} // $ MISSING: isSource=shorthand-source
134+
}
135+
136+
func testShorthandTokens(obj: ShorthandTest, string: String) {
137+
obj.sinkArgs(
138+
string // $ isSink=shorthand-sink
139+
) // $ MISSING: isSink=shorthand-sink
140+
}

0 commit comments

Comments
 (0)