Skip to content

Fix indentation and remove trailing whitespace of test files #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Tests/PackageDescription/PackageDescriptionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class PackageTests: XCTestCase, XCTestCaseProvider {
("testBasics", testBasics),
]
}

func testBasics() {
// Verify that we can round trip a basic package through TOML.
let p1 = Package(name: "a", dependencies: [.Package(url: "https://example.com/example", majorVersion: 1)])
Expand Down
30 changes: 15 additions & 15 deletions Tests/dep/DependencyGraphTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ class VersionGraphTests: XCTestCase {
("testNoGraph", testNoGraph),
("testOneDependency", testOneDependency),
("testOneDepenencyWithMultipleAvailableVersions", testOneDepenencyWithMultipleAvailableVersions),
("testOneDepenencyWithMultipleAvailableVersions", testOneDepenencyWithMultipleAvailableVersions),
("testTwoDependencies", testTwoDependencies),
("testTwoDirectDependencies", testTwoDirectDependencies),
("testTwoDirectDependenciesWhereOneAlsoDependsOnTheOther", testTwoDirectDependenciesWhereOneAlsoDependsOnTheOther),
("testSimpleVersionRestrictedGraph", testSimpleVersionRestrictedGraph),
("testComplexVersionRestrictedGraph", testComplexVersionRestrictedGraph),
("testVersionConstrain", testVersionConstrain),
("testTwoDependenciesRequireMutuallyExclusiveVersionsOfTheSameDependency_Simple", testTwoDependenciesRequireMutuallyExclusiveVersionsOfTheSameDependency_Simple),
("testTwoDependenciesRequireMutuallyExclusiveVersionsOfTheSameDependency_Complex", testTwoDependenciesRequireMutuallyExclusiveVersionsOfTheSameDependency_Complex),
("testVersionUnavailable", testVersionUnavailable)
("testOneDepenencyWithMultipleAvailableVersions", testOneDepenencyWithMultipleAvailableVersions),
("testTwoDependencies", testTwoDependencies),
("testTwoDirectDependencies", testTwoDirectDependencies),
("testTwoDirectDependenciesWhereOneAlsoDependsOnTheOther", testTwoDirectDependenciesWhereOneAlsoDependsOnTheOther),
("testSimpleVersionRestrictedGraph", testSimpleVersionRestrictedGraph),
("testComplexVersionRestrictedGraph", testComplexVersionRestrictedGraph),
("testVersionConstrain", testVersionConstrain),
("testTwoDependenciesRequireMutuallyExclusiveVersionsOfTheSameDependency_Simple", testTwoDependenciesRequireMutuallyExclusiveVersionsOfTheSameDependency_Simple),
("testTwoDependenciesRequireMutuallyExclusiveVersionsOfTheSameDependency_Complex", testTwoDependenciesRequireMutuallyExclusiveVersionsOfTheSameDependency_Complex),
("testVersionUnavailable", testVersionUnavailable)
]
}

func testNoGraph() {
class MockFetcher: _MockFetcher {
override func fetch(url url: String) throws -> Fetchable {
Expand Down Expand Up @@ -332,10 +332,10 @@ private let v199 = Version(1,9,9)

private enum MockProject: String {
case A
case B
case C
case D
case E
case B
case C
case D
case E
case F
var url: String { return rawValue }
}
Expand Down
46 changes: 23 additions & 23 deletions Tests/dep/FunctionalBuildTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class FunctionalBuildTests: XCTestCase, XCTestCaseProvider {
XCTAssertNotNil(try? executeSwiftBuild(prefix))
}
}

func verifyFilesExist(files: [String], fixturePath: String) -> Bool {
for file in files {
let name = fixturePath.characters.split("/").map(String.init).last!
Expand All @@ -80,23 +80,23 @@ class FunctionalBuildTests: XCTestCase, XCTestCaseProvider {
default:
filePath = Path.join(fixturePath, ".build/debug", file)
}

guard filePath.isFile else { return false }
}
return true
}

func testIgnoreFiles() {
fixture(name: "20_ignore_files") { prefix in
XCTAssertNotNil(try? executeSwiftBuild(prefix))

let targets = try! determineTargets(packageName: "foo", prefix: prefix)

XCTAssertEqual(targets.count, 1)
XCTAssertEqual(targets[0].sources.map({ $0.basename }), ["Foo.swift"])
}
}

// 2: Package with one library target
func testSingleLibTarget() {
let filesToVerify = ["rootLib"]
Expand All @@ -105,8 +105,8 @@ class FunctionalBuildTests: XCTestCase, XCTestCaseProvider {
XCTAssertTrue(self.verifyFilesExist(filesToVerify, fixturePath: prefix))
}
}


// 3: Package with multiple library targets
func testMultipleLibTargets() {
let filesToVerify = ["BarLib.a", "FooBarLib.a", "FooLib.a"]
Expand All @@ -115,8 +115,8 @@ class FunctionalBuildTests: XCTestCase, XCTestCaseProvider {
XCTAssertTrue(self.verifyFilesExist(filesToVerify, fixturePath: prefix))
}
}


// 4: Package with one executable target
func testSingleExecTarget() {
let filesToVerify = ["rootExec"]
Expand All @@ -125,7 +125,7 @@ class FunctionalBuildTests: XCTestCase, XCTestCaseProvider {
XCTAssertTrue(self.verifyFilesExist(filesToVerify, fixturePath: prefix))
}
}

// 5: Package with multiple exectuble targets
func testMultipleExecTargets() {
let filesToVerify = ["BarExec", "FooBarExec", "FooExec"]
Expand All @@ -152,7 +152,7 @@ class FunctionalBuildTests: XCTestCase, XCTestCaseProvider {
XCTAssertTrue(self.verifyFilesExist(filesToVerify, fixturePath: prefix))
}
}

// 8: Package with multiple library targets in a sources directory
func testMultipleLibTargetsInSources() {
let filesToVerify = ["BarLib.a", "FooBarLib.a", "FooLib.a"]
Expand All @@ -161,7 +161,7 @@ class FunctionalBuildTests: XCTestCase, XCTestCaseProvider {
XCTAssertTrue(self.verifyFilesExist(filesToVerify, fixturePath: prefix))
}
}

// 9: Package with a single executable target in a sources directory
func testSingleExecTargetInSources() {
let filesToVerify = ["rootExec"]
Expand All @@ -170,7 +170,7 @@ class FunctionalBuildTests: XCTestCase, XCTestCaseProvider {
XCTAssertTrue(self.verifyFilesExist(filesToVerify, fixturePath: prefix))
}
}

// 10: Package with multiple executable targets in a sources directory
func testMultipleExecTargetsInSources() {
let filesToVerify = ["BarExec", "FooBarExec", "FooExec"]
Expand All @@ -188,7 +188,7 @@ class FunctionalBuildTests: XCTestCase, XCTestCaseProvider {
XCTAssertTrue(self.verifyFilesExist(filesToVerify, fixturePath: prefix))
}
}

// 12: Package with a single library targets in a src directory
func testSingleLibTargetSrc() {
let filesToVerify = ["rootLib"]
Expand Down Expand Up @@ -238,8 +238,8 @@ class FunctionalBuildTests: XCTestCase, XCTestCaseProvider {
}
}
}


// 17: Package with multiple library targets in a sources and src directory
func testMultipleLibTargetsSourcesSrc() {
fixture(name: "17_buildlib_src_sources") { prefix in
Expand All @@ -253,8 +253,8 @@ class FunctionalBuildTests: XCTestCase, XCTestCaseProvider {
}
}
}


// 18: Package with multiple executable and library targets in a sources and src directory
func testMultipleLibExecTargetsSourcesSrc() {
fixture(name: "18_buildlibexec_src_sources") { prefix in
Expand All @@ -268,8 +268,8 @@ class FunctionalBuildTests: XCTestCase, XCTestCaseProvider {
}
}
}


// 19: Package with multiple executable and library targets in a sources and src directory, and externally
func testMultipleLibExecTargetsSourcesSrcExt() {
fixture(name: "19_buildlibexec_src_sources_external") { prefix in
Expand All @@ -283,8 +283,8 @@ class FunctionalBuildTests: XCTestCase, XCTestCaseProvider {
}
}
}


// 20: Single dependency where BarLib depends on FooLib
func testLibDep() {
let filesToVerify = ["BarLib.a", "FooLib.a"]
Expand Down
8 changes: 4 additions & 4 deletions Tests/dep/ManifestTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ManifestTests: XCTestCase, XCTestCaseProvider {
("testManifestLoading", testManifestLoading),
]
}

private func loadManifest(inputName: String) -> Manifest {
let input = Path.join(__FILE__, "../Inputs", inputName).normpath
do {
Expand All @@ -30,20 +30,20 @@ class ManifestTests: XCTestCase, XCTestCaseProvider {
fatalError("unexpected error: \(err)")
}
}

func testManifestLoading() {
// Check a trivial manifest.
var manifest = loadManifest("trivial-manifest")
XCTAssertEqual(manifest.package.name, "Trivial")
XCTAssertEqual(manifest.package.targets, [])
XCTAssertEqual(manifest.package.dependencies, [])

// Check a manifest with package specifications.
manifest = loadManifest("package-deps-manifest")
XCTAssertEqual(manifest.package.name, "PackageDeps")
XCTAssertEqual(manifest.package.targets, [])
XCTAssertEqual(manifest.package.dependencies, [Package.Dependency.Package(url: "https://example.com/example", majorVersion: 1)])

// Check a manifest with targets.
manifest = loadManifest("target-deps-manifest")
XCTAssertEqual(manifest.package.name, "TargetDeps")
Expand Down
4 changes: 2 additions & 2 deletions Tests/dep/PackageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import XCTest
@testable import dep

class PackageTests: XCTestCase {

var allTests : [(String, () -> ())] {
return []
}

func testInitializer() {
do {
// valid path, but no manifest so check throw is correct
Expand Down
2 changes: 1 addition & 1 deletion Tests/dep/TargetTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class TargetTests: XCTestCase, XCTestCaseProvider {
("test6", test6),
]
}

func test1() {
let t1 = try! Target(name: "t1", files: [], type: .Library)
let t2 = try! Target(name: "t2", files: [], type: .Library)
Expand Down
2 changes: 1 addition & 1 deletion Tests/dep/Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func fixture(name fixtureName: String, tag: String = "1.2.3", @noescape body: (S
}
var stream = TempStream()
print(error, toStream: &stream)

XCTFail("\(stream.result)")
}
}
Expand Down
14 changes: 7 additions & 7 deletions Tests/dep/VersionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ class VersionTests: XCTestCase, XCTestCaseProvider {
("testRange", testRange),
]
}

func testEquality() {
func test(@autoclosure v: () -> Version) {
XCTAssertEqual(v(), v())
}

test(Version(1,2,3))
test(Version(0,0,0))
test(Version(Int.min, Int.min, Int.min))
test(Version(Int.max, Int.max, Int.max))
}

func testNegativeValuesBecomeZero() {
XCTAssertEqual(Version(-1, -2, -3), Version(0,0,0))
}

func testComparable() {
do {
let v1 = Version(1,2,3)
Expand Down Expand Up @@ -104,19 +104,19 @@ class VersionTests: XCTestCase, XCTestCaseProvider {
XCTAssertGreaterThanOrEqual(v8, v8)
}
}

func testDescription() {
XCTAssertEqual(Version(123,234,345).description, "123.234.345")
}

func testFromString() {
XCTAssertNil(Version(""))
XCTAssertNil(Version("1"))
XCTAssertNil(Version("1.2"))
XCTAssertEqual(Version(1,2,3), Version("1.2.3"))
XCTAssertNil(Version("1.2.3.4"))
XCTAssertNil(Version("1.2.3.4.5"))

XCTAssertNil(Version("a"))
XCTAssertNil(Version("1.a"))
XCTAssertNil(Version("a.2"))
Expand Down
20 changes: 10 additions & 10 deletions Tests/sys/PathTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class PathTests: XCTestCase {

var allTests : [(String, () -> ())] {
return [
("test", test),
("test", test),
("testPrecombined", testPrecombined),
("testExtraSeparators", testExtraSeparators),
("testEmpties", testEmpties),
Expand Down Expand Up @@ -93,11 +93,11 @@ class WalkTests: XCTestCase {

var allTests : [(String, () -> ())] {
return [
("testNonRecursive", testNonRecursive),
("testNonRecursive", testNonRecursive),
("testRecursive", testRecursive),
]
}
}

func testNonRecursive() {
var expected = ["/usr", "/bin", "/sbin"]

Expand Down Expand Up @@ -132,13 +132,13 @@ class StatTests: XCTestCase {

var allTests : [(String, () -> ())] {
return [
("test_isdir", test_isdir),
("test_isdir", test_isdir),
("test_isfile", test_isfile),
("test_realpath", test_realpath),
("test_basename", test_basename),
]
}
}

func test_isdir() {
XCTAssertTrue("/usr".isDirectory)
XCTAssertTrue("/etc/passwd".isFile)
Expand Down Expand Up @@ -166,12 +166,12 @@ class RelativePathTests: XCTestCase {

var allTests : [(String, () -> ())] {
return [
("testAbsolute", testAbsolute),
("testAbsolute", testAbsolute),
("testRelative", testRelative),
("testMixed", testMixed),
]
}
}

func testAbsolute() {
XCTAssertEqual("2/3", Path("/1/2/3").relative(to: "/1/"))
XCTAssertEqual("3/4", Path("/1/2////3/4///").relative(to: "////1//2//"))
Expand Down
2 changes: 1 addition & 1 deletion Tests/sys/ResourcesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ResourcesTests: XCTestCase, XCTestCaseProvider {
("testResources", testResources),
]
}

func testResources() {
// Cause resources to be initialized, even though the path won't actually be correct.
Resources.initialize(&globalSymbolInNonMainBinary)
Expand Down
4 changes: 2 additions & 2 deletions Tests/sys/ShellTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ class ShellTests: XCTestCase, XCTestCaseProvider {
("testPopenWithBufferLargerThanThatAllocated", testPopenWithBufferLargerThanThatAllocated)
]
}

func testPopen() {
XCTAssertEqual(try! popen(["echo", "foo"]), "foo\n")
}

func testPopenWithBufferLargerThanThatAllocated() {
let path = Path.join(__FILE__, "../../dep/FunctionalBuildTests.swift").normpath
XCTAssertGreaterThan(try! popen(["cat", path]).characters.count, 4096)
Expand Down
Loading