File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
swift/ql/test/library-tests/dataflow/flowsources Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+
2+ // --- stubs ---
3+
4+ struct URL {
5+ init ? ( string: String ) { }
6+ }
7+
8+ class MyClass {
9+ init ( contentsOfFile: String ) { }
10+ init ( contentsOfFile: String ? , options: [ Int ] ) { }
11+ init ( contentsOf: URL , fileTypeHint: Int ) { }
12+
13+ init ( contentsOfPath: String ) { }
14+ init ( contentsOfDirectory: String ) { }
15+
16+ func append( contentsOf: String ) { }
17+ func appending( contentsOf: String ) -> MyClass { return self }
18+ }
19+
20+ // --- tests ---
21+
22+ func testCustom( ) {
23+ let url = URL ( string: " http://example.com/ " ) !
24+
25+ let x = MyClass ( contentsOfFile: " foo.txt " ) // $ MISSING: source=remote
26+ _ = MyClass ( contentsOfFile: " foo.txt " , options: [ ] ) // $ MISSING: source=remote
27+ _ = MyClass ( contentsOf: url, fileTypeHint: 1 ) // $ MISSING: source=remote
28+
29+ _ = MyClass ( contentsOfPath: " /foo/bar " ) // $ MISSING: source=remote
30+ _ = MyClass ( contentsOfDirectory: " /foo/bar " ) // $ MISSING: source=remote
31+
32+ x. append ( contentsOf: " abcdef " ) // (not a flow source)
33+ _ = x. appending ( contentsOf: " abcdef " ) // (not a flow source)
34+ }
You can’t perform that action at this time.
0 commit comments