|
| 1 | +import SomeModule |
| 2 | + |
| 3 | +func test() { |
| 4 | + print(SomeFunc()) |
| 5 | + let wrapper = XWrapper(x: 43) |
| 6 | + print(wrapper.x) |
| 7 | +} |
| 8 | + |
| 9 | +// RUN: %empty-directory(%t) |
| 10 | +// RUN: %empty-directory(%t/modulecache) |
| 11 | +// |
| 12 | +// Tests CursorInfo works with modules imported via their .swiftinterface file. |
| 13 | +// Setup builds a module interface (.swiftinterface) and doc file (.swiftdoc), |
| 14 | +// for SomeModule (built from the SomeModule.swift input) that is imported in |
| 15 | +// this file. No .swiftmodule is produced to force it into loading via the |
| 16 | +// .swiftinterface file. |
| 17 | + |
| 18 | +// Setup phase 1: build the module interface (.swiftinterface) and doc (.swiftdoc). |
| 19 | +// |
| 20 | +// RUN: %target-swift-frontend -I %t -module-name SomeModule -emit-parseable-module-interface-path %t/SomeModule.swiftinterface -emit-module-doc-path %t/SomeModule.swiftdoc %S/Inputs/SomeModule.swift -emit-module -o /dev/null |
| 21 | + |
| 22 | +// Actual test: Check the CusorInfo results of references to symbols in that |
| 23 | +// module, including the available refactoring actions, and associated doc |
| 24 | +// comments (from the .swiftdoc file). |
| 25 | +// |
| 26 | +// RUN: %sourcekitd-test -req=cursor -cursor-action -pos=1:8 %s -- -I %t -module-cache-path %t/modulecache -target %target-triple %s | %FileCheck %s -check-prefix=CHECK1 |
| 27 | +// CHECK1: source.lang.swift.ref.module |
| 28 | +// CHECK1: SomeModule |
| 29 | +// CHECK1: ACTIONS BEGIN |
| 30 | +// CHECK1-NEXT: ACTIONS END |
| 31 | + |
| 32 | +// RUN: %sourcekitd-test -req=cursor -cursor-action -pos=4:9 %s -- -I %t -module-cache-path %t/modulecache -target %target-triple %s | %FileCheck %s -check-prefix=CHECK2 |
| 33 | +// CHECK2: source.lang.swift.ref.function.free |
| 34 | +// CHECK2: SomeFunc() |
| 35 | +// CHECK2: () -> Int |
| 36 | +// CHECK2: SomeModule |
| 37 | +// CHECK2: <CommentParts><Abstract><Para>This is SomeFunc that serves some function</Para></Abstract><ResultDiscussion><Para>42</Para></ResultDiscussion></CommentParts> |
| 38 | +// CHECK2: ACTIONS BEGIN |
| 39 | +// CHECK2-NEXT: source.refactoring.kind.rename.global |
| 40 | +// CHECK2-NEXT: Global Rename |
| 41 | +// CHECK2-NEXT: symbol without a declaration location cannot be renamed |
| 42 | +// CHECK2-NEXT: ACTIONS END |
| 43 | + |
| 44 | +// RUN: %sourcekitd-test -req=cursor -cursor-action -pos=5:17 %s -- -I %t -module-cache-path %t/modulecache -target %target-triple %s | %FileCheck %s -check-prefix=CHECK3 |
| 45 | +// CHECK3: source.lang.swift.ref.struct |
| 46 | +// CHECK3: XWrapper |
| 47 | +// CHECK3: XWrapper.Type |
| 48 | +// CHECK3: SomeModule |
| 49 | +// CHECK3: ACTIONS BEGIN |
| 50 | +// CHECK3-NEXT: source.refactoring.kind.rename.global |
| 51 | +// CHECK3-NEXT: Global Rename |
| 52 | +// CHECK3-NEXT: symbol without a declaration location cannot be renamed |
| 53 | +// CHECK3-NEXT: ACTIONS END |
| 54 | + |
| 55 | +// RUN: %sourcekitd-test -req=cursor -cursor-action -pos=6:9 %s -- -I %t -module-cache-path %t/modulecache -target %target-triple %s | %FileCheck %s -check-prefix=CHECK4 |
| 56 | +// CHECK4: source.lang.swift.ref.var.local |
| 57 | +// CHECK4: wrapper |
| 58 | +// CHECK4: XWrapper |
| 59 | +// CHECK4: ACTIONS BEGIN |
| 60 | +// CHECK4-NEXT: source.refactoring.kind.rename.local |
| 61 | +// CHECK4-NEXT: Local Rename |
| 62 | +// CHECK4-NEXT: ACTIONS END |
| 63 | + |
| 64 | +// RUN: %sourcekitd-test -req=cursor -cursor-action -pos=6:17 %s -- -I %t -module-cache-path %t/modulecache -target %target-triple %s | %FileCheck %s -check-prefix=CHECK5 |
| 65 | +// CHECK5: source.lang.swift.ref.var.instance |
| 66 | +// CHECK5: x |
| 67 | +// CHECK5: Int |
| 68 | +// CHECK5: SomeModule |
| 69 | +// CHECK5: <CommentParts><Abstract><Para>This is x, a property of XWrapper</Para></Abstract></CommentParts> |
| 70 | +// CHECK5: ACTIONS BEGIN |
| 71 | +// CHECK5-NEXT: source.refactoring.kind.rename.global |
| 72 | +// CHECK5-NEXT: Global Rename |
| 73 | +// CHECK5-NEXT: symbol without a declaration location cannot be renamed |
| 74 | +// CHECK5-NEXT: ACTIONS END |
0 commit comments