Skip to content

Commit d00a7b7

Browse files
committed
Revert "Update Set<AnyHashable> test case that no longer crashes"
This reverts commit 6abc848.
1 parent 32f577a commit d00a7b7

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

validation-test/stdlib/SetAnyHashableExtensions.swift

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ SetTests.test("insert<Hashable>(_:)") {
126126
expectEqual(expected, s)
127127
}
128128

129-
SetTests.test("insert<Hashable>(_:)/FormerCastTrap") {
129+
SetTests.test("insert<Hashable>(_:)/CastTrap")
130+
.crashOutputMatches("Could not cast value of type 'main.TestHashableDerivedA'")
131+
.crashOutputMatches("to 'main.TestHashableDerivedB'")
132+
.code {
130133
var s: Set<AnyHashable> = [
131134
AnyHashable(TestHashableDerivedA(1010, identity: 1)),
132135
]
@@ -138,6 +141,7 @@ SetTests.test("insert<Hashable>(_:)/FormerCastTrap") {
138141
expectEqual(1, memberAfterInsert.identity)
139142
}
140143

144+
expectCrashLater()
141145
_ = s.insert(TestHashableDerivedB(1010, identity: 3))
142146
}
143147

@@ -177,7 +181,10 @@ SetTests.test("update<Hashable>(with:)") {
177181
expectEqual(expected, s)
178182
}
179183

180-
SetTests.test("update<Hashable>(with:)/FormerCastTrap") {
184+
SetTests.test("update<Hashable>(with:)/CastTrap")
185+
.crashOutputMatches("Could not cast value of type 'main.TestHashableDerivedA'")
186+
.crashOutputMatches("to 'main.TestHashableDerivedB'")
187+
.code {
181188
var s: Set<AnyHashable> = [
182189
AnyHashable(TestHashableDerivedA(1010, identity: 1)),
183190
]
@@ -187,6 +194,7 @@ SetTests.test("update<Hashable>(with:)/FormerCastTrap") {
187194
expectEqual(1, old.identity)
188195
}
189196

197+
expectCrashLater()
190198
s.update(with: TestHashableDerivedB(1010, identity: 3))
191199
}
192200

@@ -220,7 +228,10 @@ SetTests.test("remove<Hashable>(_:)") {
220228
}
221229
}
222230

223-
SetTests.test("remove<Hashable>(_:)/FormerCastTrap") {
231+
SetTests.test("remove<Hashable>(_:)/CastTrap")
232+
.crashOutputMatches("Could not cast value of type 'main.TestHashableDerivedA'")
233+
.crashOutputMatches("to 'main.TestHashableDerivedB'")
234+
.code {
224235
var s: Set<AnyHashable> = [
225236
AnyHashable(TestHashableDerivedA(1010, identity: 1)),
226237
AnyHashable(TestHashableDerivedA(2020, identity: 1)),
@@ -232,6 +243,7 @@ SetTests.test("remove<Hashable>(_:)/FormerCastTrap") {
232243
expectEqual(1, old.identity)
233244
}
234245

246+
expectCrashLater()
235247
s.remove(TestHashableDerivedB(2020, identity: 2))
236248
}
237249

0 commit comments

Comments
 (0)