Skip to content

Commit fd5aaa5

Browse files
committed
Add a test with -emit-imported-module
1 parent 7cabcc9 commit fd5aaa5

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/// Test -emit-imported-modules with module aliasing.
2+
///
3+
4+
// RUN: %empty-directory(%t)
5+
// RUN: %{python} %utils/split_file.py -o %t %s
6+
7+
/// Create AppleLogging.swiftmodule by aliasing XLogging
8+
// RUN: %target-swift-frontend -module-name AppleLogging -module-alias XLogging=AppleLogging %t/FileLogging.swift -emit-module -emit-module-path %t/AppleLogging.swiftmodule
9+
// RUN: test -f %t/AppleLogging.swiftmodule
10+
11+
/// Verify emitted imported modules contains AppleLogging as a module name
12+
// RUN: %target-swift-frontend -emit-imported-modules %t/FileLib.swift -module-alias XLogging=AppleLogging -I %t > %t/result.output
13+
14+
// RUN: %FileCheck %s -input-file %t/result.output -check-prefix CHECK-AST
15+
// CHECK-AST: AppleLogging
16+
// RUN: not %FileCheck %s -input-file %t/result.output -check-prefix CHECK-NOT-AST
17+
// CHECK-NOT-AST: XLogging
18+
19+
20+
// BEGIN FileLogging.swift
21+
public struct Logger {
22+
public init() {}
23+
}
24+
public func setup() -> XLogging.Logger? {
25+
return Logger()
26+
}
27+
28+
// BEGIN FileLib.swift
29+
import XLogging
30+
31+
public func start() -> XLogging.Logger? {
32+
return XLogging.setup()
33+
}
34+
35+
public func end(_ arg: XLogging.Logger) {
36+
}
37+

0 commit comments

Comments
 (0)