Skip to content

Commit f7e4935

Browse files
authored
Safeguard against forgetting to add new tests to the Linux test suite (#6)
1 parent 78ab4fb commit f7e4935

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Tests/SortedArrayTests/SortedArrayTests.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ class SortedArrayTests: XCTestCase {
1010
super.tearDown()
1111
}
1212

13+
func testLinuxTestSuiteIncludesAllTests() {
14+
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
15+
let darwinTestCount = Int(SortedArrayTests.defaultTestSuite().testCaseCount)
16+
let linuxTestCount = SortedArrayTests.allTests.count
17+
XCTAssertEqual(linuxTestCount, darwinTestCount, "allTests (used for testing on Linux) is missing \(darwinTestCount - linuxTestCount) tests")
18+
#endif
19+
}
20+
1321
func testInitUnsortedSorts() {
1422
let sut = SortedArray(unsorted: [3,4,2,1], areInIncreasingOrder: <)
1523
assertElementsEqual(sut, [1,2,3,4])
@@ -224,6 +232,7 @@ class SortedArrayTests: XCTestCase {
224232
extension SortedArrayTests {
225233
static var allTests : [(String, (SortedArrayTests) -> () throws -> Void)] {
226234
return [
235+
("testLinuxTestSuiteIncludesAllTests", testLinuxTestSuiteIncludesAllTests),
227236
("testInitUnsortedSorts", testInitUnsortedSorts),
228237
("testInitSortedDoesntResort", testInitSortedDoesntResort),
229238
("testSortedArrayCanUseArbitraryComparisonPredicate", testSortedArrayCanUseArbitraryComparisonPredicate),

0 commit comments

Comments
 (0)