Skip to content

Commit

Permalink
Update linux-tests; fail if warnings on travis
Browse files Browse the repository at this point in the history
* Update linux-tests; fail if warnings on travis

* Fix warnings on Linux

* Typo

* Can’t test these on Linux
  • Loading branch information
mxcl authored Aug 18, 2019
1 parent 0ef50df commit 3012265
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
14 changes: 9 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Sources/Path+FileManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Sources/Path+ls.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 8 additions & 4 deletions Tests/PathTests/PathTests+ls().swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand All @@ -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
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/PathTests/XCTestManifests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ extension PathTests {
("testFilesystemAttributes", testFilesystemAttributes),
("testFindExtension", testFindExtension),
("testFindKinds", testFindKinds),
("testFindMaxDepth0", testFindMaxDepth0),
("testFindMaxDepth1", testFindMaxDepth1),
("testFindMaxDepth2", testFindMaxDepth2),
("testFlatMap", testFlatMap),
("testInitializerForRelativePath", testInitializerForRelativePath),
("testIsDirectory", testIsDirectory),
Expand Down

0 comments on commit 3012265

Please sign in to comment.