Skip to content

Commit d9f2d34

Browse files
committed
Swift: Add an inline expectations test for flow sources.
1 parent 6cec8ec commit d9f2d34

File tree

2 files changed

+135
-0
lines changed

2 files changed

+135
-0
lines changed
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
| alamofire.swift:91:27:91:27 | .result | Unexpected result: source=remote |
2+
| alamofire.swift:99:27:99:27 | .result | Unexpected result: source=remote |
3+
| alamofire.swift:344:23:344:32 | .data | Unexpected result: source=remote |
4+
| alamofire.swift:351:22:351:31 | .value | Unexpected result: source=remote |
5+
| alamofire.swift:358:23:358:32 | .value | Unexpected result: source=remote |
6+
| alamofire.swift:365:22:365:31 | .value | Unexpected result: source=remote |
7+
| alamofire.swift:372:23:372:32 | .value | Unexpected result: source=remote |
8+
| alamofire.swift:379:28:379:37 | .value | Unexpected result: source=remote |
9+
| alamofire.swift:389:28:389:55 | call to String.init(contentsOfFile:) | Unexpected result: source=remote |
10+
| alamofire.swift:396:22:396:31 | .value | Unexpected result: source=remote |
11+
| alamofire.swift:403:22:403:31 | .value | Unexpected result: source=remote |
12+
| alamofire.swift:404:28:404:50 | call to String.init(contentsOf:) | Unexpected result: source=remote |
13+
| alamofire.swift:411:23:411:32 | .value | Unexpected result: source=remote |
14+
| alamofire.swift:418:22:418:31 | .value | Unexpected result: source=remote |
15+
| alamofire.swift:425:23:425:32 | .value | Unexpected result: source=remote |
16+
| alamofire.swift:431:28:431:37 | .value | Unexpected result: source=remote |
17+
| alamofire.swift:448:20:448:49 | call to String.init(contentsOfFile:) | Unexpected result: source=remote |
18+
| alamofire.swift:455:23:455:32 | .data | Unexpected result: source=remote |
19+
| alamofire.swift:461:23:461:32 | .data | Unexpected result: source=remote |
20+
| customurlschemes.swift:53:44:53:54 | url | Unexpected result: source=remote |
21+
| customurlschemes.swift:57:52:57:68 | url | Unexpected result: source=remote |
22+
| customurlschemes.swift:61:52:61:62 | url | Unexpected result: source=remote |
23+
| customurlschemes.swift:66:9:66:28 | ...[...] | Unexpected result: source=remote |
24+
| customurlschemes.swift:71:9:71:28 | ...[...] | Unexpected result: source=remote |
25+
| customurlschemes.swift:77:59:77:76 | options | Unexpected result: source=remote |
26+
| customurlschemes.swift:78:28:78:38 | continue | Unexpected result: source=remote |
27+
| customurlschemes.swift:79:28:79:39 | didUpdate | Unexpected result: source=remote |
28+
| customurlschemes.swift:80:28:80:65 | openURLContexts | Unexpected result: source=remote |
29+
| customurlschemes.swift:86:59:86:76 | options | Unexpected result: source=remote |
30+
| customurlschemes.swift:87:28:87:38 | continue | Unexpected result: source=remote |
31+
| customurlschemes.swift:88:28:88:39 | didUpdate | Unexpected result: source=remote |
32+
| customurlschemes.swift:89:28:89:65 | openURLContexts | Unexpected result: source=remote |
33+
| data.swift:18:20:18:54 | call to Data.init(contentsOf:options:) | Unexpected result: source=remote |
34+
| filemanager.swift:37:23:37:86 | call to contentsOfDirectory(at:includingPropertiesForKeys:options:) | Unexpected result: source=remote |
35+
| filemanager.swift:38:23:38:58 | call to contentsOfDirectory(atPath:) | Unexpected result: source=remote |
36+
| filemanager.swift:39:19:39:52 | call to directoryContents(atPath:) | Unexpected result: source=remote |
37+
| filemanager.swift:41:23:41:58 | call to subpathsOfDirectory(atPath:) | Unexpected result: source=remote |
38+
| filemanager.swift:42:19:42:43 | call to subpaths(atPath:) | Unexpected result: source=remote |
39+
| filemanager.swift:44:19:44:60 | call to destinationOfSymbolicLink(atPath:) | Unexpected result: source=remote |
40+
| filemanager.swift:45:15:45:56 | call to pathContentOfSymbolicLink(atPath:) | Unexpected result: source=remote |
41+
| filemanager.swift:47:14:47:38 | call to contents(atPath:) | Unexpected result: source=remote |
42+
| generics.swift:10:9:10:16 | .source1 | Unexpected result: source=remote |
43+
| generics.swift:11:9:11:16 | .source2 | Unexpected result: source=remote |
44+
| generics.swift:12:9:12:24 | call to source3() | Unexpected result: source=remote |
45+
| generics.swift:48:9:48:17 | .source1 | Unexpected result: source=remote |
46+
| generics.swift:49:9:49:17 | .source2 | Unexpected result: source=remote |
47+
| generics.swift:50:9:50:25 | call to source3() | Unexpected result: source=remote |
48+
| generics.swift:51:9:51:18 | .source1 | Unexpected result: source=remote |
49+
| generics.swift:52:9:52:18 | .source2 | Unexpected result: source=remote |
50+
| generics.swift:53:9:53:26 | call to source3() | Unexpected result: source=remote |
51+
| generics.swift:54:9:54:17 | .source1 | Unexpected result: source=remote |
52+
| generics.swift:55:9:55:17 | .source2 | Unexpected result: source=remote |
53+
| generics.swift:56:9:56:25 | call to source3() | Unexpected result: source=remote |
54+
| generics.swift:57:9:57:17 | .source4 | Unexpected result: source=remote |
55+
| generics.swift:58:9:58:17 | .source5 | Unexpected result: source=remote |
56+
| generics.swift:59:9:59:25 | call to source6() | Unexpected result: source=remote |
57+
| generics.swift:60:9:60:17 | .source7 | Unexpected result: source=remote |
58+
| generics.swift:61:9:61:25 | call to source8() | Unexpected result: source=remote |
59+
| generics.swift:62:9:62:18 | .source1 | Unexpected result: source=remote |
60+
| generics.swift:63:9:63:18 | .source2 | Unexpected result: source=remote |
61+
| generics.swift:64:9:64:26 | call to source3() | Unexpected result: source=remote |
62+
| generics.swift:65:9:65:18 | .source9 | Unexpected result: source=remote |
63+
| generics.swift:66:9:66:18 | .source10 | Unexpected result: source=remote |
64+
| generics.swift:67:9:67:27 | call to source11() | Unexpected result: source=remote |
65+
| generics.swift:68:9:68:18 | .source12 | Unexpected result: source=remote |
66+
| generics.swift:69:9:69:27 | call to source13() | Unexpected result: source=remote |
67+
| generics.swift:93:9:93:15 | .source0 | Unexpected result: source=remote |
68+
| generics.swift:94:9:94:15 | .source1 | Unexpected result: source=remote |
69+
| generics.swift:95:9:95:15 | .source2 | Unexpected result: source=remote |
70+
| generics.swift:96:9:96:14 | .source0 | Unexpected result: source=remote |
71+
| generics.swift:97:9:97:14 | .source1 | Unexpected result: source=remote |
72+
| generics.swift:98:9:98:14 | .source2 | Unexpected result: source=remote |
73+
| generics.swift:99:9:99:15 | .source0 | Unexpected result: source=remote |
74+
| generics.swift:100:9:100:15 | .source1 | Unexpected result: source=remote |
75+
| generics.swift:101:9:101:15 | .source2 | Unexpected result: source=remote |
76+
| generics.swift:125:9:125:15 | .source0 | Unexpected result: source=remote |
77+
| generics.swift:126:9:126:15 | .source1 | Unexpected result: source=remote |
78+
| generics.swift:127:9:127:15 | .source2 | Unexpected result: source=remote |
79+
| generics.swift:128:9:128:14 | .source0 | Unexpected result: source=remote |
80+
| generics.swift:129:9:129:14 | .source1 | Unexpected result: source=remote |
81+
| generics.swift:130:9:130:14 | .source2 | Unexpected result: source=remote |
82+
| generics.swift:131:9:131:15 | .source0 | Unexpected result: source=remote |
83+
| generics.swift:132:9:132:15 | .source1 | Unexpected result: source=remote |
84+
| generics.swift:133:9:133:15 | .source2 | Unexpected result: source=remote |
85+
| generics.swift:162:9:162:22 | call to source2() | Unexpected result: source=remote |
86+
| generics.swift:163:9:163:22 | call to source3() | Unexpected result: source=remote |
87+
| nsdata.swift:18:17:18:40 | call to NSData.init(contentsOf:) | Unexpected result: source=remote |
88+
| nsdata.swift:19:17:19:53 | call to NSData.init(contentsOf:options:) | Unexpected result: source=remote |
89+
| string.swift:56:21:56:44 | call to String.init(contentsOf:) | Unexpected result: source=remote |
90+
| string.swift:57:21:57:77 | call to String.init(contentsOf:encoding:) | Unexpected result: source=remote |
91+
| string.swift:59:21:59:69 | call to String.init(contentsOf:usedEncoding:) | Unexpected result: source=remote |
92+
| string.swift:62:21:62:48 | call to String.init(contentsOfFile:) | Unexpected result: source=remote |
93+
| string.swift:63:21:63:81 | call to String.init(contentsOfFile:encoding:) | Unexpected result: source=remote |
94+
| string.swift:64:21:64:73 | call to String.init(contentsOfFile:usedEncoding:) | Unexpected result: source=remote |
95+
| url.swift:53:15:53:19 | .resourceBytes | Unexpected result: source=remote |
96+
| url.swift:60:15:60:19 | .lines | Unexpected result: source=remote |
97+
| url.swift:67:16:67:22 | .lines | Unexpected result: source=remote |
98+
| webview.swift:13:32:13:49 | decidePolicyFor | Unexpected result: source=remote |
99+
| webview.swift:14:32:14:49 | decidePolicyFor | Unexpected result: source=remote |
100+
| webview.swift:41:82:41:102 | message | Unexpected result: source=remote |
101+
| webview.swift:46:5:46:13 | .globalObject | Unexpected result: source=remote |
102+
| webview.swift:47:5:47:39 | call to objectForKeyedSubscript(_:) | Unexpected result: source=remote |
103+
| webview.swift:60:9:60:9 | .tainted | Unexpected result: source=remote |
104+
| webview.swift:64:10:64:10 | self | Unexpected result: source=remote |
105+
| webview.swift:64:18:64:24 | arg1 | Unexpected result: source=remote |
106+
| webview.swift:64:29:64:35 | arg2 | Unexpected result: source=remote |
107+
| webview.swift:72:32:72:49 | decidePolicyFor | Unexpected result: source=remote |
108+
| webview.swift:73:32:73:49 | decidePolicyFor | Unexpected result: source=remote |
109+
| webview.swift:79:32:79:49 | decidePolicyFor | Unexpected result: source=remote |
110+
| webview.swift:80:32:80:49 | decidePolicyFor | Unexpected result: source=remote |
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import swift
2+
import TestUtilities.InlineExpectationsTest
3+
import FlowConfig
4+
5+
string describe(FlowSource source) {
6+
source instanceof RemoteFlowSource and result = "remote"
7+
or
8+
source instanceof LocalFlowSource and result = "local"
9+
}
10+
11+
class FlowSourcesTest extends InlineExpectationsTest {
12+
FlowSourcesTest() { this = "FlowSourcesTest" }
13+
14+
override string getARelevantTag() { result = "source" }
15+
16+
override predicate hasActualResult(Location location, string element, string tag, string value) {
17+
exists(FlowSource source |
18+
location = source.getLocation() and
19+
location.getFile().getBaseName() != "" and
20+
element = source.toString() and
21+
tag = "source" and
22+
value = describe(source)
23+
)
24+
}
25+
}

0 commit comments

Comments
 (0)