|
| 1 | +// BEGIN State1.swift |
| 2 | +import ClangFW |
| 3 | +import SwiftFW |
| 4 | + |
| 5 | +func foo(val: MyStruct) { |
| 6 | + /*HERE*/ |
| 7 | +} |
| 8 | + |
| 9 | +// BEGIN State2.swift |
| 10 | +import ClangFW |
| 11 | +import SwiftFW |
| 12 | + |
| 13 | +func foo(val: MyStruct) { |
| 14 | + val./*HERE*/ |
| 15 | +} |
| 16 | + |
| 17 | +// BEGIN DUMMY.swift |
| 18 | + |
| 19 | +// Checks that editing and saving the current file doesn't affect dependency checking. |
| 20 | +// REQUIRES: shell |
| 21 | + |
| 22 | +// RUN: %empty-directory(%t) |
| 23 | +// RUN: %empty-directory(%t/Frameworks) |
| 24 | +// RUN: %empty-directory(%t/MyProject) |
| 25 | + |
| 26 | +// RUN: %{python} %utils/split_file.py -o %t %s |
| 27 | + |
| 28 | +// RUN: COMPILER_ARGS=( \ |
| 29 | +// RUN: -target %target-triple \ |
| 30 | +// RUN: -module-name MyProject \ |
| 31 | +// RUN: -F %t/Frameworks \ |
| 32 | +// RUN: -I %t/MyProject \ |
| 33 | +// RUN: -import-objc-header %t/MyProject/Bridging.h \ |
| 34 | +// RUN: %t/MyProject/Library.swift \ |
| 35 | +// RUN: %t/test.swift \ |
| 36 | +// RUN: ) |
| 37 | +// RUN: INPUT_DIR=%S/Inputs/checkdeps |
| 38 | +// RUN: DEPCHECK_INTERVAL=1 |
| 39 | +// RUN: SLEEP_TIME=2 |
| 40 | + |
| 41 | +// RUN: cp -R $INPUT_DIR/MyProject %t/ |
| 42 | +// RUN: cp -R $INPUT_DIR/ClangFW.framework %t/Frameworks/ |
| 43 | +// RUN: %empty-directory(%t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule) |
| 44 | +// RUN: %target-swift-frontend -emit-module -module-name SwiftFW -o %t/Frameworks/SwiftFW.framework/Modules/SwiftFW.swiftmodule/%target-swiftmodule-name $INPUT_DIR/SwiftFW_src/Funcs.swift |
| 45 | + |
| 46 | +// RUN: cp %t/State1.swift %t/test.swift |
| 47 | + |
| 48 | +// RUN: %sourcekitd-test \ |
| 49 | +// RUN: -req=global-config -completion-check-dependency-interval ${DEPCHECK_INTERVAL} == \ |
| 50 | + |
| 51 | +// RUN: -shell -- echo "### Initial" == \ |
| 52 | +// RUN: -req=complete -pos=5:4 %t/test.swift -- ${COMPILER_ARGS[@]} == \ |
| 53 | + |
| 54 | +// RUN: -shell -- sleep ${SLEEP_TIME} == \ |
| 55 | +// RUN: -shell -- echo "### Modify own file - 1" == \ |
| 56 | +// RUN: -shell -- cp %t/State2.swift %t/test.swift == \ |
| 57 | +// RUN: -req=complete -pos=5:9 %t/test.swift -- ${COMPILER_ARGS[@]} == \ |
| 58 | + |
| 59 | +// RUN: -shell -- sleep ${SLEEP_TIME} == \ |
| 60 | +// RUN: -shell -- echo "### Modify own file - 2" == \ |
| 61 | +// RUN: -shell -- cp %t/State1.swift %t/test.swift == \ |
| 62 | +// RUN: -req=complete -pos=5:4 %t/test.swift -- ${COMPILER_ARGS[@]} == \ |
| 63 | + |
| 64 | +// RUN: -shell -- sleep ${SLEEP_TIME} == \ |
| 65 | +// RUN: -shell -- echo "### Modify own file - 3" == \ |
| 66 | +// RUN: -shell -- cp %t/State2.swift %t/test.swift == \ |
| 67 | +// RUN: -req=complete -pos=5:9 %t/test.swift -- ${COMPILER_ARGS[@]} \ |
| 68 | +// RUN: | %FileCheck %s |
| 69 | + |
| 70 | +// CHECK-LABEL: ### Initial |
| 71 | +// CHECK: key.results: [ |
| 72 | +// CHECK-DAG: key.description: "clangFWFunc()" |
| 73 | +// CHECK-DAG: key.description: "swiftFWFunc()" |
| 74 | +// CHECK-DAG: key.description: "localClangFunc()" |
| 75 | +// CHECK-DAG: key.description: "localSwiftFunc()" |
| 76 | +// CHECK: ] |
| 77 | +// CHECK-NOT: key.reusingastcontext: 1 |
| 78 | + |
| 79 | +// CHECK-LABEL: ### Modify own file - 1 |
| 80 | +// CHECK: key.results: [ |
| 81 | +// CHECK-DAG: key.description: "myStructMethod()" |
| 82 | +// CHECK-DAG: key.description: "self" |
| 83 | +// CHECK: ] |
| 84 | +// CHECK: key.reusingastcontext: 1 |
| 85 | + |
| 86 | +// CHECK-LABEL: ### Modify own file - 2 |
| 87 | +// CHECK: key.results: [ |
| 88 | +// CHECK-DAG: key.description: "clangFWFunc()" |
| 89 | +// CHECK-DAG: key.description: "swiftFWFunc()" |
| 90 | +// CHECK-DAG: key.description: "localClangFunc()" |
| 91 | +// CHECK-DAG: key.description: "localSwiftFunc()" |
| 92 | +// CHECK: ] |
| 93 | +// CHECK: key.reusingastcontext: 1 |
| 94 | + |
| 95 | +// CHECK-LABEL: ### Modify own file - 3 |
| 96 | +// CHECK: key.results: [ |
| 97 | +// CHECK-DAG: key.description: "myStructMethod()" |
| 98 | +// CHECK-DAG: key.description: "self" |
| 99 | +// CHECK: ] |
| 100 | +// CHECK: key.reusingastcontext: 1 |
0 commit comments