|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: %{python} %utils/split_file.py -o %t %s |
| 3 | +// RUN: %sourcekitd-test \ |
| 4 | +// RUN: -json-request-path %t/1-open-without-sourcefile.json \ |
| 5 | +// RUN: == -json-request-path %t/2-close.json \ |
| 6 | +// RUN: == -json-request-path %t/3-reopen-without-compiler-args.json \ |
| 7 | +// RUN: == -json-request-path %t/4-cursor-info.json |
| 8 | + |
| 9 | +// This used to crash with a nullptr dereference because we didn't store a |
| 10 | +// snapshot in the FileContents of a.swift since it wasn't opened with a |
| 11 | +// key.sourcefile argument. |
| 12 | + |
| 13 | +// BEGIN 1-open-without-sourcefile.json |
| 14 | +{ |
| 15 | + key.request: source.request.editor.open, |
| 16 | + key.name: "/invalid/a.swift", |
| 17 | + key.compilerargs: [ |
| 18 | + "/invalid/a.swift", |
| 19 | + "/invalid/b.swift" |
| 20 | + ], |
| 21 | + key.sourcetext: "", |
| 22 | + key.enablesyntaxmap: 0, |
| 23 | + key.enablesubstructure: 0, |
| 24 | + key.enablediagnostics: 0 |
| 25 | +} |
| 26 | +// BEGIN 2-close.json |
| 27 | +{ |
| 28 | + key.request: source.request.editor.close, |
| 29 | + key.name: "/invalid/a.swift" |
| 30 | +} |
| 31 | +// BEGIN 3-reopen-without-compiler-args.json |
| 32 | +{ |
| 33 | + key.request: source.request.editor.open, |
| 34 | + key.name: "/invalid/a.swift", |
| 35 | + key.compilerargs: [ |
| 36 | + ], |
| 37 | + key.sourcetext: "", |
| 38 | + key.enablesyntaxmap: 0, |
| 39 | + key.enablesubstructure: 0, |
| 40 | + key.enablediagnostics: 0 |
| 41 | +} |
| 42 | +// BEGIN 4-cursor-info.json |
| 43 | +{ |
| 44 | + key.request: source.request.cursorinfo, |
| 45 | + key.compilerargs: [ |
| 46 | + "/invalid/a.swift", |
| 47 | + "/invalid/b.swift" |
| 48 | + ], |
| 49 | + key.offset: 0, |
| 50 | + key.sourcefile: "/invalid/a.swift" |
| 51 | +} |
0 commit comments