Skip to content

Commit 88b295c

Browse files
numistlorentey
authored andcommitted
Only instanciate one test suite--this was confusing the test framework, causing some strange crashes
(cherry picked from commit 9b45fc4)
1 parent 9322750 commit 88b295c

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

test/stdlib/Diffing.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
import Swift
55
import StdlibUnittest
66

7-
let suite = "Diffing"
7+
let suite = TestSuite("Diffing")
88

9-
TestSuite(suite).test("Diffing empty collections") {
9+
suite.test("Diffing empty collections") {
1010
let a = [Int]()
1111
let b = [Int]()
1212
let diff = b.difference(from: a)
1313
expectEqual(diff, a.difference(from: a))
1414
expectTrue(diff.isEmpty)
1515
}
1616

17-
TestSuite(suite).test("Basic diffing algorithm validators") {
17+
suite.test("Basic diffing algorithm validators") {
1818
let expectedChanges: [(
1919
source: [String],
2020
target: [String],
@@ -340,7 +340,7 @@ TestSuite(suite).test("Basic diffing algorithm validators") {
340340
}
341341
}
342342

343-
TestSuite(suite).test("Empty diffs have sane behaviour") {
343+
suite.test("Empty diffs have sane behaviour") {
344344
guard let diff = CollectionDifference<String>([]) else {
345345
expectUnreachable()
346346
return
@@ -354,7 +354,7 @@ TestSuite(suite).test("Empty diffs have sane behaviour") {
354354
expectEqual(0, c)
355355
}
356356

357-
TestSuite(suite).test("Happy path tests for the change validator") {
357+
suite.test("Happy path tests for the change validator") {
358358
// Base case: one insert and one remove with legal offsets
359359
expectNotNil(CollectionDifference<Int>.init([
360360
.insert(offset: 0, element: 0, associatedWith: nil),
@@ -372,7 +372,7 @@ TestSuite(suite).test("Happy path tests for the change validator") {
372372
]))
373373
}
374374

375-
TestSuite(suite).test("Exhaustive edge case tests for the change validator") {
375+
suite.test("Exhaustive edge case tests for the change validator") {
376376
// Base case: two inserts sharing the same offset
377377
expectNil(CollectionDifference<Int>.init([
378378
.insert(offset: 0, element: 0, associatedWith: nil),
@@ -430,7 +430,7 @@ TestSuite(suite).test("Exhaustive edge case tests for the change validator") {
430430
]))
431431
}
432432

433-
TestSuite(suite).test("Enumeration order is safe") {
433+
suite.test("Enumeration order is safe") {
434434
let safelyOrderedChanges: [CollectionDifference<Int>.Change] = [
435435
.remove(offset: 2, element: 0, associatedWith: nil),
436436
.remove(offset: 1, element: 0, associatedWith: 0),
@@ -447,7 +447,7 @@ TestSuite(suite).test("Enumeration order is safe") {
447447
expectEqual(safelyOrderedChanges, enumerationOrderedChanges)
448448
}
449449

450-
TestSuite(suite).test("Change validator rejects bad associations") {
450+
suite.test("Change validator rejects bad associations") {
451451
// .remove(1) → .insert(1)
452452
// ↑ ↓
453453
// .insert(0) ← .remove(0)
@@ -472,7 +472,7 @@ TestSuite(suite).test("Change validator rejects bad associations") {
472472
}
473473

474474
// Full-coverage test for CollectionDifference.Change.==()
475-
TestSuite(suite).test("Exhaustive testing for equatable conformance") {
475+
suite.test("Exhaustive testing for equatable conformance") {
476476
// Differs by type:
477477
expectNotEqual(
478478
CollectionDifference<Int>.Change.insert(offset: 0, element: 0, associatedWith: 0),
@@ -522,11 +522,11 @@ TestSuite(suite).test("Exhaustive testing for equatable conformance") {
522522
)
523523
}
524524

525-
TestSuite(suite).test("Compile-time test of hashable conformance") {
525+
suite.test("Compile-time test of hashable conformance") {
526526
let _ = Set<CollectionDifference<String>>();
527527
}
528528

529-
TestSuite(suite).test("Move inference") {
529+
suite.test("Move inference") {
530530
let n = CollectionDifference<String>.init([
531531
.insert(offset: 3, element: "Sike", associatedWith: nil),
532532
.insert(offset: 4, element: "Sike", associatedWith: nil),
@@ -546,7 +546,7 @@ TestSuite(suite).test("Move inference") {
546546
expectEqual(w, n?.inferringMoves())
547547
}
548548

549-
TestSuite(suite).test("Three way diff demo code") {
549+
suite.test("Three way diff demo code") {
550550
let base = "Is\nit\ntime\nalready?"
551551
let theirs = "Hi\nthere\nis\nit\ntime\nalready?"
552552
let mine = "Is\nit\nreview\ntime\nalready?"
@@ -571,7 +571,7 @@ TestSuite(suite).test("Three way diff demo code") {
571571
// print(patched)
572572
}
573573

574-
TestSuite(suite).test("Diff reversal demo code") {
574+
suite.test("Diff reversal demo code") {
575575
let diff = CollectionDifference<Int>([])!
576576
let _ = CollectionDifference<Int>(
577577
diff.map({(change) -> CollectionDifference<Int>.Change in
@@ -585,7 +585,7 @@ TestSuite(suite).test("Diff reversal demo code") {
585585
)!
586586
}
587587

588-
TestSuite(suite).test("Naive application by enumeration") {
588+
suite.test("Naive application by enumeration") {
589589
let base = "Is\nit\ntime\nalready?"
590590
let theirs = "Hi\nthere\nis\nit\ntime\nalready?"
591591

@@ -608,7 +608,7 @@ TestSuite(suite).test("Naive application by enumeration") {
608608
expectEqual(arr, theirLines)
609609
}
610610

611-
TestSuite(suite).test("Fast applicator boundary conditions") {
611+
suite.test("Fast applicator boundary conditions") {
612612
let a = [1, 2, 3, 4, 5, 6, 7, 8]
613613
for removeMiddle in [false, true] {
614614
for insertMiddle in [false, true] {
@@ -634,7 +634,7 @@ TestSuite(suite).test("Fast applicator boundary conditions") {
634634
}}}}}}
635635
}
636636

637-
TestSuite(suite).test("Fast applicator fuzzer") {
637+
suite.test("Fast applicator fuzzer") {
638638
func makeArray() -> [Int] {
639639
var arr = [Int]()
640640
for _ in 0..<Int.random(in: 0..<10) {

0 commit comments

Comments
 (0)