Update linux-tests; fail if warnings on travis

* Update linux-tests; fail if warnings on travis

* Fix warnings on Linux

* Typo

* Can’t test these on Linux
This commit is contained in:
Max Howell
2019-08-18 16:52:24 -04:00
committed by GitHub
parent 0ef50dff2e
commit 30122659a5
5 changed files with 21 additions and 13 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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<Int> = 1...Int.max
/// The kinds of filesystem entries find operations will return.

View File

@@ -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
}
}
}

View File

@@ -26,8 +26,8 @@ extension PathTests {
("testFilesystemAttributes", testFilesystemAttributes),
("testFindExtension", testFindExtension),
("testFindKinds", testFindKinds),
("testFindMaxDepth0", testFindMaxDepth0),
("testFindMaxDepth1", testFindMaxDepth1),
("testFindMaxDepth2", testFindMaxDepth2),
("testFlatMap", testFlatMap),
("testInitializerForRelativePath", testInitializerForRelativePath),
("testIsDirectory", testIsDirectory),