|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: mkdir -p %t/clang-module-cache |
| 3 | +// RUN: mkdir -p %t/inputs |
| 4 | +// RUN: echo "/// Some cool comments" > %t/foo.swift |
| 5 | +// RUN: echo "public func foo() {}" >> %t/foo.swift |
| 6 | + |
| 7 | +// Step 1: build .swiftmodule and .swiftinterface adjacent to each other from foo.swift |
| 8 | +// RUN: %target-swift-frontend -emit-module -emit-module-path %t/inputs/Foo.swiftmodule -emit-module-doc-path %t/inputs/Foo.swiftdoc -emit-module-source-info -emit-module-source-info-path %t/inputs/Foo.swiftsourceinfo -emit-module-interface-path %t/inputs/Foo.swiftinterface -module-cache-path %t.module-cache %t/foo.swift -module-name Foo |
| 9 | + |
| 10 | +// Step 2: build .swiftmodule from .swiftinterface and give the adjacent .swiftmodule as a candidate compiled module. |
| 11 | +// RUN: %target-swift-frontend -compile-module-from-interface %t/inputs/Foo.swiftinterface -o %t/inputs/Foo-from-interface.swiftmodule -module-name Foo -candidate-module-file %t/inputs/Foo.swiftmodule |
| 12 | + |
| 13 | +// Step 3: the new .swiftmodule should be a fowarding module. |
| 14 | +// RUN: %{python} %S/../ModuleInterface/ModuleCache/Inputs/check-is-forwarding-module.py %t/inputs/Foo-from-interface.swiftmodule |
| 15 | + |
| 16 | +// Step 4: using the forwarding module in explicit module map should be OK. |
| 17 | +// RUN: echo "[{" > %/t/inputs/map.json |
| 18 | +// RUN: echo "\"moduleName\": \"Foo\"," >> %/t/inputs/map.json |
| 19 | +// RUN: echo "\"modulePath\": \"%/t/inputs/Foo-from-interface.swiftmodule\"," >> %/t/inputs/map.json |
| 20 | +// RUN: echo "\"docPath\": \"%/t/inputs/Foo.swiftdoc\"," >> %/t/inputs/map.json |
| 21 | +// RUN: echo "\"sourceInfoPath\": \"%/t/inputs/Foo.swiftsourceinfo\"" >> %/t/inputs/map.json |
| 22 | +// RUN: echo "}]" >> %/t/inputs/map.json |
| 23 | + |
| 24 | +// RUN: %target-swift-ide-test -print-module-comments -module-to-print=Foo -enable-swiftsourceinfo -source-filename %s -explicit-swift-module-map-file %t/inputs/map.json | %FileCheck %s |
| 25 | + |
| 26 | +// CHECK: foo.swift:2:13: Func/foo RawComment=[/// Some cool comments |
0 commit comments