-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from mxcl/Path.source()
Add `Path.source()`
- Loading branch information
Showing
5 changed files
with
72 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
ignore: | ||
- Tests | ||
- Tests/PathTests/etc.swift | ||
- Tests/PathTests/TemporaryDirectory.swift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,10 +14,9 @@ jobs: | |
strategy: | ||
matrix: | ||
xcode: | ||
#- 10.3 # Swift 5.0 (doesn’t work on GHA macOS image :-/) | ||
# - 10.3 # Swift 5.0 (doesn’t work on GHA macOS image :-/) | ||
- 11.3 # Swift 5.1 | ||
- ^11.4 # Swift 5.2 | ||
- latest # Swift 5.3 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: setup-xcode | ||
|
@@ -34,9 +33,13 @@ jobs: | |
destination: | ||
- platform=iOS Simulator,OS=latest,name=iPhone 11 | ||
- platform=tvOS Simulator,OS=latest,name=Apple TV | ||
- platform=macOS # for code-coverage | ||
- platform=macOS | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: maxim-lobanov/[email protected] | ||
with: | ||
xcode-version: 12 # Swift 5.3 | ||
- run: swift --version | ||
- run: swift package generate-xcodeproj --enable-code-coverage | ||
- uses: sersoft-gmbh/xcodebuild-action@v1 | ||
with: | ||
|
@@ -50,36 +53,39 @@ jobs: | |
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: swift package generate-xcodeproj --enable-code-coverage | ||
- run: swift package generate-xcodeproj | ||
- uses: sersoft-gmbh/xcodebuild-action@v1 | ||
with: | ||
project: Path.swift.xcodeproj | ||
scheme: Path.swift-Package | ||
destination: platform=watchOS Simulator,OS=latest,name=Apple Watch Series 5 - 40mm | ||
action: build | ||
linux-4-2: | ||
needs: smoke | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: fwal/setup-swift@v1 | ||
with: | ||
swift-version: 4.2 | ||
- run: swift test --parallel # doesn’t support code coverage | ||
linux: | ||
needs: smoke | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
swift: | ||
# - 4.0.3 fails for some reason | ||
- 4.2 | ||
- 5.0.3 | ||
- 5.1 | ||
- 5.2 | ||
# - 5.3 not available yet sigh | ||
# - 5.3 not yet available sigh | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: fwal/setup-swift@v1 | ||
with: | ||
swift-version: ${{ matrix.swift }} | ||
- run: swift test --parallel --enable-code-coverage | ||
if: ${{ matrix.swift != '4.2' }} | ||
- run: swift test --parallel | ||
if: ${{ matrix.swift == '4.2' }} | ||
- name: Generate Coverage Report | ||
if: ${{ matrix.swift != '4.2' }} | ||
run: | | ||
sudo apt-get -qq update && sudo apt-get -qq install llvm-10 | ||
export b=$(swift build --show-bin-path) && llvm-cov-10 \ | ||
|
@@ -89,6 +95,5 @@ jobs: | |
$b/Path.swiftPackageTests.xctest \ | ||
> info.lcov | ||
- uses: codecov/codecov-action@v1 | ||
if: ${{ matrix.swift != '4.2' }} | ||
with: | ||
file: ./info.lcov | ||
file: ./info.lcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,43 @@ | ||
import XCTest | ||
import Path | ||
|
||
#if swift(>=5.3) | ||
func XCTAssertEqual<P: Pathish>(_ set1: Set<Path>, _ set2: Set<Path>, _ message: @autoclosure () -> String = "", file: StaticString = #filePath, line: UInt = #line, relativeTo: P) { | ||
logic(set1, set2, relativeTo: relativeTo) { | ||
XCTFail($0, file: file, line: line) | ||
} | ||
} | ||
#else | ||
func XCTAssertEqual<P: Pathish>(_ set1: Set<Path>, _ set2: Set<Path>, _ message: @autoclosure () -> String = "", file: StaticString = #file, line: UInt = #line, relativeTo: P) { | ||
logic(set1, set2, relativeTo: relativeTo) { | ||
XCTFail($0, file: file, line: line) | ||
} | ||
} | ||
#endif | ||
|
||
private func logic<P: Pathish>(_ set1: Set<Path>, _ set2: Set<Path>, relativeTo: P, fail: (String) -> Void) { | ||
if set1 != set2 { | ||
let cvt: (Path) -> String = { $0.relative(to: relativeTo) } | ||
let out1 = set1.map(cvt).sorted() | ||
let out2 = set1.map(cvt).sorted() | ||
XCTFail("Set(\(out1)) is not equal to Set(\(out2))", file: file, line: line) | ||
fail("Set(\(out1)) is not equal to Set(\(out2))") | ||
} | ||
} | ||
|
||
#if swift(>=5.3) | ||
func XCTAssertEqual<P: Pathish, Q: Pathish>(_ p: P, _ q: Q, file: StaticString = #filePath, line: UInt = #line) { | ||
XCTAssertEqual(p.string, q.string, file: file, line: line) | ||
} | ||
|
||
func XCTAssertEqual<P: Pathish, Q: Pathish>(_ p: P?, _ q: Q?, file: StaticString = #filePath, line: UInt = #line) { | ||
XCTAssertEqual(p?.string, q?.string, file: file, line: line) | ||
} | ||
#else | ||
func XCTAssertEqual<P: Pathish, Q: Pathish>(_ p: P, _ q: Q, file: StaticString = #file, line: UInt = #line) { | ||
XCTAssertEqual(p.string, q.string, file: file, line: line) | ||
} | ||
|
||
func XCTAssertEqual<P: Pathish, Q: Pathish>(_ p: P?, _ q: Q?, file: StaticString = #file, line: UInt = #line) { | ||
XCTAssertEqual(p?.string, q?.string, file: file, line: line) | ||
} | ||
#endif |