From 30122659a5e3250d99fa26ded1dbb27959d890ee Mon Sep 17 00:00:00 2001 From: Max Howell Date: Sun, 18 Aug 2019 16:52:24 -0400 Subject: [PATCH] Update linux-tests; fail if warnings on travis MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update linux-tests; fail if warnings on travis * Fix warnings on Linux * Typo * Can’t test these on Linux --- .travis.yml | 14 +++++++++----- Sources/Path+FileManager.swift | 4 ++-- Sources/Path+ls.swift | 2 +- Tests/PathTests/PathTests+ls().swift | 12 ++++++++---- Tests/PathTests/XCTestManifests.swift | 2 +- 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index d06ba4f..b033358 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,18 +16,21 @@ xcode_scheme: Path.swift-Package jobs: include: - name: macOS / Swift 4.0.3 + before_script: swift build -Xswiftc -warnings-as-errors script: swift test --parallel -Xswiftc -swift-version -Xswiftc 4 - - name: macOS / Swift 4.2.1 + - &std + name: macOS / Swift 4.2.1 + before_script: swift build -Xswiftc -warnings-as-errors script: swift test --parallel - - name: macOS / Swift 5.0 + - <<: *std + name: macOS / Swift 5.0 osx_image: xcode10.2 - script: swift test --parallel - - name: macOS / Swift 5.1 + - <<: *std + name: macOS / Swift 5.1 osx_image: xcode11 - script: swift test --parallel - &xcodebuild before_install: swift package generate-xcodeproj --enable-code-coverage @@ -57,6 +60,7 @@ jobs: language: generic sudo: false install: eval "$(curl -sL https://swiftenv.fuller.li/install.sh)" + before_script: swift build -Xswiftc -warnings-as-errors script: swift test --parallel - <<: *linux diff --git a/Sources/Path+FileManager.swift b/Sources/Path+FileManager.swift index 83b4e8b..6d9d8c5 100644 --- a/Sources/Path+FileManager.swift +++ b/Sources/Path+FileManager.swift @@ -30,7 +30,7 @@ public extension Pathish { try FileManager.default.removeItem(at: to.url) } #if os(Linux) && !swift(>=5.2) // check if fixed - if !overwrite, to.kind != nil { + if !overwrite, to.type != nil { throw CocoaError.error(.fileWriteFileExists) } #endif @@ -70,7 +70,7 @@ public extension Pathish { try FileManager.default.removeItem(at: rv.url) } #if os(Linux) && !swift(>=5.2) // check if fixed - if !overwrite, rv.kind != nil { + if !overwrite, rv.type != nil { throw CocoaError.error(.fileWriteFileExists) } #endif diff --git a/Sources/Path+ls.swift b/Sources/Path+ls.swift index 9ef5c14..de97bdf 100644 --- a/Sources/Path+ls.swift +++ b/Sources/Path+ls.swift @@ -13,7 +13,7 @@ public extension Path { private let enumerator: FileManager.DirectoryEnumerator! - /// The range of directory depths for which the find operation will return entries.b + /// The range of directory depths for which the find operation will return entries. private(set) public var depth: ClosedRange = 1...Int.max /// The kinds of filesystem entries find operations will return. diff --git a/Tests/PathTests/PathTests+ls().swift b/Tests/PathTests/PathTests+ls().swift index cff02b5..92471a2 100644 --- a/Tests/PathTests/PathTests+ls().swift +++ b/Tests/PathTests/PathTests+ls().swift @@ -11,16 +11,16 @@ extension PathTests { do { let finder = tmpdir.find().depth(max: 1) XCTAssertEqual(finder.depth, 1...1) - #if !os(Linux) || swift(>=5) + #if !os(Linux) || swift(>=5) XCTAssertEqual(Set(finder), Set([tmpdir.a, tmpdir.b, tmpdir.c].map(Path.init))) - #endif + #endif } do { let finder = tmpdir.find().depth(max: 0) XCTAssertEqual(finder.depth, 0...0) - #if !os(Linux) || swift(>=5) + #if !os(Linux) || swift(>=5) XCTAssertEqual(Set(finder), Set()) - #endif + #endif } } } @@ -34,16 +34,20 @@ extension PathTests { do { let finder = tmpdir.find().depth(max: 2) XCTAssertEqual(finder.depth, 1...2) + #if !os(Linux) || swift(>=5) XCTAssertEqual( Set(finder), Set([tmpdir.a, tmpdir.b, tmpdir.b.d, tmpdir.b.c].map(Path.init))) + #endif } do { let finder = tmpdir.find().depth(max: 3) XCTAssertEqual(finder.depth, 1...3) + #if !os(Linux) || swift(>=5) XCTAssertEqual( Set(finder), Set([tmpdir.a, tmpdir.b, tmpdir.b.d, tmpdir.b.c, tmpdir.b.d.e].map(Path.init))) + #endif } } } diff --git a/Tests/PathTests/XCTestManifests.swift b/Tests/PathTests/XCTestManifests.swift index 1b0931f..7bcb17c 100644 --- a/Tests/PathTests/XCTestManifests.swift +++ b/Tests/PathTests/XCTestManifests.swift @@ -26,8 +26,8 @@ extension PathTests { ("testFilesystemAttributes", testFilesystemAttributes), ("testFindExtension", testFindExtension), ("testFindKinds", testFindKinds), - ("testFindMaxDepth0", testFindMaxDepth0), ("testFindMaxDepth1", testFindMaxDepth1), + ("testFindMaxDepth2", testFindMaxDepth2), ("testFlatMap", testFlatMap), ("testInitializerForRelativePath", testInitializerForRelativePath), ("testIsDirectory", testIsDirectory),