Skip to content

Commit d8104e7

Browse files
authored
Evolution tests: Don't bother testing changing a class's superclass (#15000)
We're okay with saying this is a binary-breaking change, and its presence in these tests is interfering with testing other things. rdar://problem/36932507
1 parent 22cddbf commit d8104e7

File tree

4 files changed

+9
-70
lines changed

4 files changed

+9
-70
lines changed

validation-test/Evolution/Inputs/superclass_methods.swift

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,9 @@ open class Base {
1414
open class func classMethod() -> String {
1515
return "Base.classMethod()"
1616
}
17-
}
1817

19-
open class OtherBase {
20-
public init() {}
21-
open func method() -> String {
22-
return "OtherBase.method()"
23-
}
24-
open class func classMethod() -> String {
25-
return "OtherBase.classMethod()"
18+
open func nonOverriddenMethod() -> String {
19+
return "Base.nonOverriddenMethod()"
2620
}
2721
}
2822

@@ -66,9 +60,3 @@ open class InsertSuperclass : Base {}
6660
#else
6761
open class InsertSuperclass : InBetween {}
6862
#endif
69-
70-
#if BEFORE
71-
open class ChangeRoot : Base {}
72-
#else
73-
open class ChangeRoot : OtherBase {}
74-
#endif

validation-test/Evolution/Inputs/superclass_properties.swift

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,11 @@ open class Base {
1111
open var property: String {
1212
return "Base.property"
1313
}
14-
open class var classProperty: String {
15-
return "Base.classProperty"
16-
}
17-
}
18-
19-
open class OtherBase {
20-
public init() {}
21-
open var property: String {
22-
return "OtherBase.property"
14+
open var nonOverriddenProperty: String {
15+
return "Base.nonOverriddenProperty"
2316
}
2417
open class var classProperty: String {
25-
return "OtherBase.classProperty"
18+
return "Base.classProperty"
2619
}
2720
}
2821

@@ -66,9 +59,3 @@ open class InsertSuperclass : Base {}
6659
#else
6760
open class InsertSuperclass : InBetween {}
6861
#endif
69-
70-
#if BEFORE
71-
open class ChangeRoot : Base {}
72-
#else
73-
open class ChangeRoot : OtherBase {}
74-
#endif

validation-test/Evolution/test_superclass_methods.swift

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,33 +59,15 @@ SuperclassMethodsTest.test("InsertSuperclass") {
5959
}
6060
if getVersion() == 0 {
6161
expectEqual(Leaf().method(), "Base.method()")
62+
expectEqual(Leaf().nonOverriddenMethod(), "Base.nonOverriddenMethod()")
6263
expectEqual(Leaf.classMethod(), "Base.classMethod()")
6364
} else {
6465
expectEqual(Leaf().method(), "InBetween.method()")
66+
expectEqual(Leaf().nonOverriddenMethod(), "Base.nonOverriddenMethod()")
6567
expectEqual(Leaf.classMethod(), "InBetween.classMethod()")
6668
}
6769
}
6870
}
6971

70-
SuperclassMethodsTest.test("ChangeRoot") {
71-
do {
72-
class Leaf : ChangeRoot {
73-
override func method() -> String {
74-
return super.method()
75-
}
76-
override class func classMethod() -> String {
77-
return super.classMethod()
78-
}
79-
}
80-
if getVersion() == 0 {
81-
expectEqual(Leaf().method(), "Base.method()")
82-
expectEqual(Leaf.classMethod(), "Base.classMethod()")
83-
} else {
84-
expectEqual(Leaf().method(), "OtherBase.method()")
85-
expectEqual(Leaf.classMethod(), "OtherBase.classMethod()")
86-
}
87-
}
88-
}
89-
9072
runAllTests()
9173

validation-test/Evolution/test_superclass_properties.swift

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,32 +59,14 @@ SuperclassPropertiesTest.test("InsertSuperclass") {
5959
}
6060
if getVersion() == 0 {
6161
expectEqual(Leaf().property, "Base.property")
62+
expectEqual(Leaf().nonOverriddenProperty, "Base.nonOverriddenProperty")
6263
expectEqual(Leaf.classProperty, "Base.classProperty")
6364
} else {
6465
expectEqual(Leaf().property, "InBetween.property")
66+
expectEqual(Leaf().nonOverriddenProperty, "Base.nonOverriddenProperty")
6567
expectEqual(Leaf.classProperty, "InBetween.classProperty")
6668
}
6769
}
6870
}
6971

70-
SuperclassPropertiesTest.test("ChangeRoot") {
71-
do {
72-
class Leaf : ChangeRoot {
73-
override var property: String {
74-
return super.property
75-
}
76-
override class var classProperty: String {
77-
return super.classProperty
78-
}
79-
}
80-
if getVersion() == 0 {
81-
expectEqual(Leaf().property, "Base.property")
82-
expectEqual(Leaf.classProperty, "Base.classProperty")
83-
} else {
84-
expectEqual(Leaf().property, "OtherBase.property")
85-
expectEqual(Leaf.classProperty, "OtherBase.classProperty")
86-
}
87-
}
88-
}
89-
9072
runAllTests()

0 commit comments

Comments
 (0)