From f9ce7ee8539f2b7daf6976e00ca215c0fd79f938 Mon Sep 17 00:00:00 2001 From: Brian Croom Date: Thu, 18 Feb 2016 06:49:53 +0100 Subject: [PATCH] Update the allTests declarations for compatibility with the latest Corelibs XCTest --- Tests/Build/DescribeTests.swift | 6 +-- Tests/Functional/TestModuleMaps.swift | 2 +- Tests/Functional/TestValidLayouts.swift | 19 ++++---- Tests/Get/RawCloneTests.swift | 14 +++--- Tests/LinuxMain.swift | 50 ++++++++++----------- Tests/ManifestParser/TOMLTests.swift | 14 +++--- Tests/PackageDescription/PackageTests.swift | 8 +--- Tests/PackageDescription/VersionTests.swift | 6 +-- Tests/PackageType/PackageNameTests.swift | 6 +-- Tests/Transmute/ModuleTests.swift | 6 +-- Tests/Utility/FileTests.swift | 42 +++++++++-------- 11 files changed, 76 insertions(+), 97 deletions(-) diff --git a/Tests/Build/DescribeTests.swift b/Tests/Build/DescribeTests.swift index 81c7fbdd888..d0f51865af4 100644 --- a/Tests/Build/DescribeTests.swift +++ b/Tests/Build/DescribeTests.swift @@ -24,12 +24,10 @@ final class DescribeTests: XCTestCase { } } -#if os(Linux) -extension DescribeTests: XCTestCaseProvider { - var allTests: [(String, () throws -> Void)] { +extension DescribeTests { + static var allTests: [(String, DescribeTests -> () throws -> Void)] { return [ ("testDescribingNoModulesThrows", testDescribingNoModulesThrows), ] } } -#endif diff --git a/Tests/Functional/TestModuleMaps.swift b/Tests/Functional/TestModuleMaps.swift index 1268ca08815..dbfb55cc292 100644 --- a/Tests/Functional/TestModuleMaps.swift +++ b/Tests/Functional/TestModuleMaps.swift @@ -72,7 +72,7 @@ class ModuleMapsTestCase: XCTestCase { extension ModuleMapsTestCase { - var allTests : [(String, () throws -> Void)] { + static var allTests : [(String, ModuleMapsTestCase -> () throws -> Void)] { return [ ("testDirectDependency", testDirectDependency), ("testTransitiveDependency", testTransitiveDependency), diff --git a/Tests/Functional/TestValidLayouts.swift b/Tests/Functional/TestValidLayouts.swift index b1997466cac..37c0dad7ade 100644 --- a/Tests/Functional/TestValidLayouts.swift +++ b/Tests/Functional/TestValidLayouts.swift @@ -131,9 +131,8 @@ extension ValidLayoutsTestCase { } -#if os(Linux) -extension DependencyResolutionTestCase: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension DependencyResolutionTestCase { + static var allTests : [(String, DependencyResolutionTestCase -> () throws -> Void)] { return [ ("testInternalSimple", testInternalSimple), ("testInternalComplex", testInternalComplex), @@ -143,8 +142,8 @@ extension DependencyResolutionTestCase: XCTestCaseProvider { } } -extension InvalidLayoutsTestCase: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension InvalidLayoutsTestCase { + static var allTests : [(String, InvalidLayoutsTestCase -> () throws -> Void)] { return [ ("testNoTargets", testNoTargets), ("testMultipleRoots", testMultipleRoots), @@ -157,8 +156,8 @@ extension InvalidLayoutsTestCase: XCTestCaseProvider { } } -extension MiscellaneousTestCase: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension MiscellaneousTestCase { + static var allTests : [(String, MiscellaneousTestCase -> () throws -> Void)] { return [ ("testPrintsSelectedDependencyVersion", testPrintsSelectedDependencyVersion), ("testManifestExcludes1", testManifestExcludes1), @@ -183,9 +182,8 @@ extension MiscellaneousTestCase: XCTestCaseProvider { } } - -extension ValidLayoutsTestCase: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension ValidLayoutsTestCase { + static var allTests : [(String, ValidLayoutsTestCase -> () throws -> Void)] { return [ ("testSingleModuleLibrary", testSingleModuleLibrary), ("testSingleModuleExecutable", testSingleModuleExecutable), @@ -198,4 +196,3 @@ extension ValidLayoutsTestCase: XCTestCaseProvider { ] } } -#endif diff --git a/Tests/Get/RawCloneTests.swift b/Tests/Get/RawCloneTests.swift index 1740de54c26..1eb683792be 100644 --- a/Tests/Get/RawCloneTests.swift +++ b/Tests/Get/RawCloneTests.swift @@ -78,9 +78,8 @@ private func tryCloningRepoWithTag(tag: String?, shouldCrash: Bool) { } -#if os(Linux) -extension VersionGraphTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension VersionGraphTests { + static var allTests : [(String, VersionGraphTests -> () throws -> Void)] { return [ ("testNoGraph", testNoGraph), ("testOneDependency", testOneDependency), @@ -99,8 +98,8 @@ extension VersionGraphTests: XCTestCaseProvider { } } -extension GetTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension GetTests { + static var allTests : [(String, GetTests -> () throws -> Void)] { return [ ("testRawCloneDoesNotCrashIfManifestIsNotPresent", testRawCloneDoesNotCrashIfManifestIsNotPresent), ("testRangeConstrain", testRangeConstrain), @@ -109,8 +108,8 @@ extension GetTests: XCTestCaseProvider { } } -extension GitTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension GitTests { + static var allTests : [(String, GitTests -> () throws -> Void)] { return [ ("testHasVersion", testHasVersion), ("testHasNoVersion", testHasNoVersion), @@ -119,4 +118,3 @@ extension GitTests: XCTestCaseProvider { ] } } -#endif diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift index c41548bd1a6..8ada342b99e 100644 --- a/Tests/LinuxMain.swift +++ b/Tests/LinuxMain.swift @@ -15,29 +15,29 @@ import XCTest @testable import Buildtest XCTMain([ - DependencyResolutionTestCase(), - FileTests(), - GetTests(), - GitTests(), - InvalidLayoutsTestCase(), - ManifestTests(), - MiscellaneousTestCase(), - ManifestParsertest.PackageTests(), - ModuleTests(), - PackageDescriptiontest.PackageTests(), - PackageTypetest.PackageTests(), - PathTests(), - RelativePathTests(), - ResourcesTests(), - ShellTests(), - StatTests(), - StringTests(), - TOMLTests(), - URLTests(), - ValidLayoutsTestCase(), - VersionGraphTests(), - VersionTests(), - WalkTests(), - ModuleMapsTestCase(), - DescribeTests(), + testCase(DependencyResolutionTestCase.allTests), + testCase(FileTests.allTests), + testCase(GetTests.allTests), + testCase(GitTests.allTests), + testCase(InvalidLayoutsTestCase.allTests), + testCase(ManifestTests.allTests), + testCase(MiscellaneousTestCase.allTests), + testCase(ManifestParsertest.PackageTests.allTests), + testCase(ModuleTests.allTests), + testCase(PackageDescriptiontest.PackageTests.allTests), + testCase(PackageTypetest.PackageTests.allTests), + testCase(PathTests.allTests), + testCase(RelativePathTests.allTests), + testCase(ResourcesTests.allTests), + testCase(ShellTests.allTests), + testCase(StatTests.allTests), + testCase(StringTests.allTests), + testCase(TOMLTests.allTests), + testCase(URLTests.allTests), + testCase(ValidLayoutsTestCase.allTests), + testCase(VersionGraphTests.allTests), + testCase(VersionTests.allTests), + testCase(WalkTests.allTests), + testCase(ModuleMapsTestCase.allTests), + testCase(DescribeTests.allTests), ]) diff --git a/Tests/ManifestParser/TOMLTests.swift b/Tests/ManifestParser/TOMLTests.swift index affbaa64fe8..c97f040fc83 100644 --- a/Tests/ManifestParser/TOMLTests.swift +++ b/Tests/ManifestParser/TOMLTests.swift @@ -108,9 +108,8 @@ class TOMLTests: XCTestCase { } -#if os(Linux) -extension TOMLTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension TOMLTests { + static var allTests : [(String, TOMLTests -> () throws -> Void)] { return [ ("testLexer", testLexer), ("testParser", testParser), @@ -119,16 +118,16 @@ extension TOMLTests: XCTestCaseProvider { } } -extension ManifestTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension ManifestTests { + static var allTests : [(String, ManifestTests -> () throws -> Void)] { return [ ("testManifestLoading", testManifestLoading), ] } } -extension PackageTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension PackageTests { + static var allTests : [(String, PackageTests -> () throws -> Void)] { return [ ("testBasics", testBasics), ("testExclude", testExclude), @@ -138,4 +137,3 @@ extension PackageTests: XCTestCaseProvider { ] } } -#endif diff --git a/Tests/PackageDescription/PackageTests.swift b/Tests/PackageDescription/PackageTests.swift index 42feb6c76f7..af88c41ce31 100644 --- a/Tests/PackageDescription/PackageTests.swift +++ b/Tests/PackageDescription/PackageTests.swift @@ -29,14 +29,10 @@ class PackageTests: XCTestCase { } - -#if os(Linux) -extension PackageTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension PackageTests { + static var allTests : [(String, PackageTests -> () throws -> Void)] { return [ ("testMatchDependencyWithPreReleaseVersion", testMatchDependencyWithPreReleaseVersion), - ] } } -#endif diff --git a/Tests/PackageDescription/VersionTests.swift b/Tests/PackageDescription/VersionTests.swift index 597d33a29c0..f639fcad1f8 100644 --- a/Tests/PackageDescription/VersionTests.swift +++ b/Tests/PackageDescription/VersionTests.swift @@ -309,9 +309,8 @@ extension Array { } -#if os(Linux) -extension VersionTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension VersionTests { + static var allTests : [(String, VersionTests -> () throws -> Void)] { return [ ("testEquality", testEquality), ("testNegativeValuesBecomeZero", testNegativeValuesBecomeZero), @@ -326,4 +325,3 @@ extension VersionTests: XCTestCaseProvider { ] } } -#endif diff --git a/Tests/PackageType/PackageNameTests.swift b/Tests/PackageType/PackageNameTests.swift index 74393335247..e8841f8c0f6 100644 --- a/Tests/PackageType/PackageNameTests.swift +++ b/Tests/PackageType/PackageNameTests.swift @@ -35,9 +35,8 @@ class PackageTests: XCTestCase { } -#if os(Linux) -extension PackageTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension PackageTests { + static var allTests : [(String, PackageTests -> () throws -> Void)] { return [ ("testUrlEndsInDotGit1", testUrlEndsInDotGit1), ("testUrlEndsInDotGit2", testUrlEndsInDotGit2), @@ -46,4 +45,3 @@ extension PackageTests: XCTestCaseProvider { ] } } -#endif diff --git a/Tests/Transmute/ModuleTests.swift b/Tests/Transmute/ModuleTests.swift index cde0f9e1045..1d50f439e78 100644 --- a/Tests/Transmute/ModuleTests.swift +++ b/Tests/Transmute/ModuleTests.swift @@ -224,9 +224,8 @@ extension ModuleTests { } -#if os(Linux) -extension ModuleTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension ModuleTests { + static var allTests : [(String, ModuleTests -> () throws -> Void)] { return [ ("test1", test1), ("test2", test2), @@ -240,4 +239,3 @@ extension ModuleTests: XCTestCaseProvider { ] } } -#endif diff --git a/Tests/Utility/FileTests.swift b/Tests/Utility/FileTests.swift index 773b8bb2129..48dc1b8d631 100644 --- a/Tests/Utility/FileTests.swift +++ b/Tests/Utility/FileTests.swift @@ -69,9 +69,8 @@ class FileTests: XCTestCase { } -#if os(Linux) -extension FileTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension FileTests { + static var allTests : [(String, FileTests -> () throws -> Void)] { return [ ("testOpenFile", testOpenFile), ("testOpenFileFail", testOpenFileFail), @@ -82,16 +81,16 @@ extension FileTests: XCTestCaseProvider { } -extension RmtreeTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension RmtreeTests { + static var allTests : [(String, RmtreeTests -> () throws -> Void)] { return [ ("testDoesNotFollowSymlinks", testDoesNotFollowSymlinks), ] } } -extension PathTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension PathTests { + static var allTests : [(String, PathTests -> () throws -> Void)] { return [ ("test", test), ("testPrecombined", testPrecombined), @@ -104,8 +103,8 @@ extension PathTests: XCTestCaseProvider { } } -extension WalkTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension WalkTests { + static var allTests : [(String, WalkTests -> () throws -> Void)] { return [ ("testNonRecursive", testNonRecursive), ("testRecursive", testRecursive), @@ -115,8 +114,8 @@ extension WalkTests: XCTestCaseProvider { } } -extension StatTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension StatTests { + static var allTests : [(String, StatTests -> () throws -> Void)] { return [ ("test_isdir", test_isdir), ("test_isfile", test_isfile), @@ -126,8 +125,8 @@ extension StatTests: XCTestCaseProvider { } } -extension RelativePathTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension RelativePathTests { + static var allTests : [(String, RelativePathTests -> () throws -> Void)] { return [ ("testAbsolute", testAbsolute), ("testRelative", testRelative), @@ -137,16 +136,16 @@ extension RelativePathTests: XCTestCaseProvider { } -extension ResourcesTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension ResourcesTests { + static var allTests : [(String, ResourcesTests -> () throws -> Void)] { return [ ("testResources", testResources), ] } } -extension ShellTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension ShellTests { + static var allTests : [(String, ShellTests -> () throws -> Void)] { return [ ("testPopen", testPopen), ("testPopenWithBufferLargerThanThatAllocated", testPopenWithBufferLargerThanThatAllocated), @@ -156,8 +155,8 @@ extension ShellTests: XCTestCaseProvider { } -extension StringTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension StringTests { + static var allTests : [(String, StringTests -> () throws -> Void)] { return [ ("testTrailingChomp", testTrailingChomp), ("testEmptyChomp", testEmptyChomp), @@ -168,11 +167,10 @@ extension StringTests: XCTestCaseProvider { } -extension URLTests: XCTestCaseProvider { - var allTests : [(String, () throws -> Void)] { +extension URLTests { + static var allTests : [(String, URLTests -> () throws -> Void)] { return [ ("testSchema", testSchema), ] } } -#endif