Skip to content

Commit c6129d9

Browse files
authoredOct 15, 2024
Merge pull request #20 from NeedleInAJayStack/chore/warnings
Fixes @retroactive conformance warnings in tests
2 parents 6717df8 + acb4771 commit c6129d9

File tree

4 files changed

+85
-73
lines changed

4 files changed

+85
-73
lines changed
 

‎.github/workflows/build.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths-ignore: [ README.md ]
7+
pull_request:
8+
branches: [ main ]
9+
paths-ignore: [ README.md ]
10+
workflow_dispatch:
11+
12+
jobs:
13+
formatlint:
14+
name: Format linting
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v2
21+
- name: Pull formatting docker image
22+
run: docker pull ghcr.io/nicklockwood/swiftformat:latest
23+
- name: Run format linting
24+
run: docker run --rm -v ${{ github.workspace }}:/repo ghcr.io/nicklockwood/swiftformat:latest /repo --lint
25+
26+
macos:
27+
name: Test on macOS
28+
runs-on: macOS-latest
29+
steps:
30+
- uses: maxim-lobanov/setup-xcode@v1
31+
with:
32+
xcode-version: latest-stable
33+
- uses: actions/checkout@v3
34+
- name: Build and test
35+
run: swift test --parallel --enable-test-discovery
36+
37+
linux:
38+
name: Test on Linux
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: swift-actions/setup-swift@v2
42+
- uses: actions/checkout@v3
43+
- name: Test
44+
run: swift test --parallel --enable-code-coverage
45+
- name: Get test coverage html
46+
run: |
47+
llvm-cov show \
48+
$(swift build --show-bin-path)/DataLoaderPackageTests.xctest \
49+
--instr-profile $(swift build --show-bin-path)/codecov/default.profdata \
50+
--ignore-filename-regex="\.build|Tests" \
51+
--format html \
52+
--output-dir=.test-coverage
53+
- name: Upload test coverage html
54+
uses: actions/upload-artifact@v3
55+
with:
56+
name: test-coverage-report
57+
path: .test-coverage
58+
59+
backcompat-ubuntu-22_04:
60+
name: Test Swift ${{ matrix.swift }} on Ubuntu 22.04
61+
runs-on: ubuntu-22.04
62+
strategy:
63+
matrix:
64+
swift: ["5.7", "5.8", "5.9", "5.10"]
65+
steps:
66+
- uses: swift-actions/setup-swift@v2
67+
with:
68+
swift-version: ${{ matrix.swift }}
69+
- uses: actions/checkout@v3
70+
- name: Test
71+
run: swift test --parallel

‎.github/workflows/test.yml

-67
This file was deleted.

‎.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,7 @@ fastlane/test_output
8787
# After new code Injection tools there's a generated folder /iOSInjectionProject
8888
# https://github.com/johnno1962/injectionforxcode
8989

90-
iOSInjectionProject/
90+
iOSInjectionProject/
91+
92+
# VS Code
93+
.vscode/

‎Tests/DataLoaderTests/DataLoaderAbuseTests.swift

+10-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ class DataLoaderAbuseTests: XCTestCase {
1919

2020
let value = try identityLoader.load(key: 1, on: eventLoopGroup)
2121

22-
XCTAssertThrowsError(try value.wait(), "Did not return value for key: 1")
22+
XCTAssertThrowsError(
23+
try value.wait(),
24+
"Did not return value for key: 1"
25+
)
2326
}
2427

2528
func testBatchFuntionMustPromiseAnArrayOfCorrectLength() throws {
@@ -53,7 +56,9 @@ class DataLoaderAbuseTests: XCTestCase {
5356
if key == 1 {
5457
results.append(DataLoaderFutureValue.success(key))
5558
} else {
56-
results.append(DataLoaderFutureValue.failure("Test error"))
59+
results.append(
60+
DataLoaderFutureValue.failure(DataLoaderError.typeError("Test error"))
61+
)
5762
}
5863
}
5964

@@ -83,7 +88,9 @@ class DataLoaderAbuseTests: XCTestCase {
8388
if key == 1 {
8489
results.append(DataLoaderFutureValue.success(key))
8590
} else {
86-
results.append(DataLoaderFutureValue.failure("Test error"))
91+
results.append(
92+
DataLoaderFutureValue.failure(DataLoaderError.typeError("Test error"))
93+
)
8794
}
8895
}
8996

@@ -98,5 +105,3 @@ class DataLoaderAbuseTests: XCTestCase {
98105
XCTAssertTrue(try value1.wait() == 1)
99106
}
100107
}
101-
102-
extension String: Error {}

0 commit comments

Comments
 (0)