splash/Tests/SplashTests/Core/TestCaseVerifier.swift

38 lines
902 B
Swift
Raw Normal View History

2018-08-24 18:42:07 +02:00
/**
* Splash
* Copyright (c) John Sundell 2018
* MIT license - see LICENSE.md
*/
import Foundation
import XCTest
struct TestCaseVerifier<Case: XCTestCase> {
static func verifyLinuxTests(_ tests: [(String, TestClosure<Case>)]) -> Bool {
#if os(macOS)
let testNames = Set(tests.map { $0.0 })
for name in Case.testNames {
guard name != "testAllTestsRunOnLinux" else {
continue
}
guard name != "testHasLinuxVerificationTest" else {
continue
}
guard testNames.contains(name) else {
XCTFail("""
Test case \(Case.self) does not include test \(name) on Linux.
Please add it to the test case's 'allTests' array.
""")
2018-08-24 18:42:07 +02:00
return false
}
}
#endif
return true
}
}