Skip to content

Commit ed098bb

Browse files
committed
[Tests] Add static keypaths module test.
1 parent 1d1d7a6 commit ed098bb

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

build.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
MODE=$1
2+
TEST=$2
3+
4+
pushd ../build/${MODE}/swift-macosx-arm64
5+
xcrun ninja -j 8 swift-frontend
6+
#xcrun ninja -j 8 swift-refactor
7+
#xcrun ninja swift-demangle
8+
#xcrun ninja swift-serialize-diagnostics
9+
#xcrun ninja sil-opt
10+
#xcrun ninja swift-ide-test
11+
#xcrun ninja sourcekitd-test
12+
#xcrun ninja stdlib
13+
#xcrun ninja swift-remoteast
14+
popd
15+
python3 ../llvm-project/llvm/utils/lit/lit.py -sv --param swift_site_config=../build/${MODE}/swift-macosx-arm64/test-macosx-arm64/lit.site.cfg ${TEST}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: split-file %s %t
3+
4+
// RUN: %target-swift-frontend -emit-module -module-name Library \
5+
// RUN: -swift-version 5 -enable-library-evolution \
6+
// RUN: -o %t/Library.swiftmodule \
7+
// RUN: -emit-module-interface-path %t/Library.swiftinterface \
8+
// RUN: %t/Library.swift
9+
10+
/// Verify that we can build from the Library.swiftmodule
11+
// RUN: %target-swift-frontend -typecheck -module-name Client \
12+
// RUN: -swift-version 5 \
13+
// RUN: %t/Client.swift -I%t
14+
15+
/// Verify what we can build from a swiftinterface, when swiftmodule was deleted
16+
// RUN: rm %t/Library.swiftmodule
17+
// RUN: %target-swift-frontend -typecheck -module-name Client \
18+
// RUN: -swift-version 5 \
19+
// RUN: %t/Client.swift -I%t
20+
21+
// REQUIRES: executable_test
22+
23+
//--- Library.swift
24+
public struct AStruct {
25+
public static var property1: Int = 1
26+
private(set) public static var property2: Int = 4
27+
private(set) public static var property3: Int = 4
28+
}
29+
30+
//--- Client.swift
31+
import Library
32+
33+
public let keyPath1 = \AStruct.Type.property1
34+
public let keyPath2 = \AStruct.Type.property2
35+
public let keyPath3 = \AStruct.Type.property3
36+
37+
// CHECK: false
38+
print(keyPath1 == keyPath2)
39+
40+
// CHECK: true
41+
print(keyPath2 == keyPath3)
42+

0 commit comments

Comments
 (0)