-
Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathtest_struct_resilient_remove_conformance.swift
76 lines (57 loc) · 2.49 KB
/
test_struct_resilient_remove_conformance.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// RUN: rm -rf %t && mkdir -p %t/before && mkdir -p %t/after
// RUN: %target-build-swift -emit-library -Xfrontend -enable-resilience -D BEFORE -c %S/Inputs/struct_resilient_remove_conformance.swift -o %t/before/struct_resilient_remove_conformance.o
// RUN: %target-build-swift -emit-module -Xfrontend -enable-resilience -D BEFORE -c %S/Inputs/struct_resilient_remove_conformance.swift -o %t/before/struct_resilient_remove_conformance.o
// RUN: %target-build-swift -emit-library -Xfrontend -enable-resilience -D AFTER -c %S/Inputs/struct_resilient_remove_conformance.swift -o %t/after/struct_resilient_remove_conformance.o
// RUN: %target-build-swift -emit-module -Xfrontend -enable-resilience -D AFTER -c %S/Inputs/struct_resilient_remove_conformance.swift -o %t/after/struct_resilient_remove_conformance.o
// RUN: %target-build-swift -D BEFORE -c %s -I %t/before -o %t/before/main.o
// RUN: %target-build-swift -D AFTER -c %s -I %t/after -o %t/after/main.o
// RUN: %target-build-swift %t/before/struct_resilient_remove_conformance.o %t/before/main.o -o %t/before_before
// RUN: %target-build-swift %t/before/struct_resilient_remove_conformance.o %t/after/main.o -o %t/before_after
// RUN: %target-build-swift %t/after/struct_resilient_remove_conformance.o %t/before/main.o -o %t/after_before
// RUN: %target-build-swift %t/after/struct_resilient_remove_conformance.o %t/after/main.o -o %t/after_after
// RUN: %target-run %t/before_before
// RUN: %target-run %t/before_after
// RUN: %target-run %t/after_before
// RUN: %target-run %t/after_after
// REQUIRES: executable_test
import StdlibUnittest
import struct_resilient_remove_conformance
var StructResilientRemoveConformanceTest = TestSuite("StructResilientRemoveConformance")
StructResilientRemoveConformanceTest.test("RemoveConformance") {
var t = RemoveConformance()
do {
t.x = 10
t.y = 20
expectEqual(t.x, 10)
expectEqual(t.y, 20)
}
}
#if AFTER
protocol MyPointLike {
var x: Int { get set }
var y: Int { get set }
}
protocol MyPoint3DLike {
var z: Int { get set }
}
extension RemoveConformance : MyPointLike {}
extension RemoveConformance : MyPoint3DLike {}
@inline(never) func workWithMyPointLike<T>(t: T) {
var p = t as! MyPointLike
p.x = 50
p.y = 60
expectEqual(p.x, 50)
expectEqual(p.y, 60)
}
StructResilientRemoveConformanceTest.test("MyPointLike") {
var p: MyPointLike = RemoveConformance()
do {
p.x = 50
p.y = 60
expectEqual(p.x, 50)
expectEqual(p.y, 60)
}
workWithMyPointLike(p)
}
#endif
runAllTests()