Skip to content

Commit aa57618

Browse files
committed
Refactor tests
1 parent 3720d4f commit aa57618

39 files changed

Lines changed: 44 additions & 62 deletions

.github/workflows/ci.yml

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
run: swift test -v --configuration debug --parallel
3333

3434
- name: Fair Test Linux (Release)
35+
if: false
3536
run: swift test -v --configuration release -Xswiftc -enable-testing --parallel
3637

3738
- name: Check fairtool formula
@@ -54,34 +55,40 @@ jobs:
5455
- name: Checkout
5556
uses: actions/checkout@v3
5657

57-
#- name: Test iOS (Debug)
58-
# run: xcodebuild test -configuration Debug -scheme "Fair-Package" -sdk "iphonesimulator" -destination "platform=iOS Simulator,name=iPhone 14 Pro"
58+
- name: Test iOS (Debug)
59+
if: false
60+
run: xcodebuild test -configuration Debug -scheme "Fair-Package" -sdk "iphonesimulator" -destination "platform=iOS Simulator,name=iPhone 14 Pro"
5961

60-
#- name: Test iOS (Release)
61-
# run: xcodebuild test -configuration Release -scheme "Fair-Package" -sdk "iphonesimulator" -destination "platform=iOS Simulator,name=iPhone 14 Pro"
62+
- name: Test iOS (Release)
63+
if: false
64+
run: xcodebuild test -configuration Release -scheme "Fair-Package" -sdk "iphonesimulator" -destination "platform=iOS Simulator,name=iPhone 14 Pro"
6265

6366
- name: Test macOS (Debug)
67+
if: false
6468
run: xcodebuild test -configuration Debug -scheme "Fair-Package" -sdk "macosx" -destination "platform=macosx"
6569

66-
#- name: Test macOS (Release)
67-
# run: xcodebuild test -configuration Release -scheme "Fair-Package" -sdk "macosx" -destination "platform=macosx"
70+
- name: Test macOS (Release)
71+
if: false
72+
run: xcodebuild test -configuration Release -scheme "Fair-Package" -sdk "macosx" -destination "platform=macosx"
6873

6974
- name: Test Package
70-
run: xcrun swift test --parallel
75+
#run: xcrun swift test --parallel
76+
run: swift test
7177

7278
- name: Run fairtool
7379
run: xcrun swift run fairtool version
7480

75-
#- name: Check fairtool formula
76-
# run: |
77-
# export HOMEBREW_NO_INSTALL_CLEANUP=1
78-
# brew install fair-ground/tool/fairtool-head
79-
# brew test fairtool-head
80-
# fairtool-head version
81-
# #fairtool-head app fork App-Name
82-
# #fairtool-head app config App-Name
83-
# #fairtool-head app release App-Name
84-
# #fairtool-head app integrate App-Name
81+
- name: Check fairtool formula
82+
if: false
83+
run: |
84+
export HOMEBREW_NO_INSTALL_CLEANUP=1
85+
brew install fair-ground/tool/fairtool-head
86+
brew test fairtool-head
87+
fairtool-head version
88+
#fairtool-head app fork App-Name
89+
#fairtool-head app config App-Name
90+
#fairtool-head app release App-Name
91+
#fairtool-head app integrate App-Name
8592
8693
api-doc:
8794
if: false

Sources/FairCore/Async.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,8 @@ extension Result: _ErrorMechanism { }
555555
import Darwin
556556
#elseif canImport(Glibc)
557557
import Glibc
558+
#elseif canImport(Musl)
559+
import Musl
558560
#elseif canImport(CRT)
559561
import CRT
560562
#endif
@@ -568,6 +570,8 @@ final actor IOActor {
568570
let read = Darwin.read
569571
#elseif canImport(Glibc)
570572
let read = Glibc.read
573+
#elseif canImport(Musl)
574+
let read = Musl.read
571575
#elseif canImport(CRT)
572576
let read = CRT._read
573577
#endif

Sources/FairCore/Documentation.docc/Documentation.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

Sources/FairCore/Extensions.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,9 @@ let systemStdout = CRT.stdout
258258
#elseif canImport(Glibc)
259259
let systemStderr = Glibc.stderr!
260260
let systemStdout = Glibc.stdout!
261+
#elseif canImport(Musl)
262+
let systemStderr = Musl.stderr!
263+
let systemStdout = Musl.stdout!
261264
#elseif canImport(WASILibc)
262265
let systemStderr = WASILibc.stderr!
263266
let systemStdout = WASILibc.stdout!
@@ -503,12 +506,10 @@ public extension StringProtocol {
503506

504507
#if os(macOS) || os(iOS)
505508
extension String {
506-
#if swift(>=5.5)
507509
/// Parses the attributed text string into an `AttributedString`
508510
@inlinable public func atx(interpret: AttributedString.MarkdownParsingOptions.InterpretedSyntax = .inlineOnlyPreservingWhitespace, allowsExtendedAttributes: Bool = true, languageCode: String? = nil) throws -> AttributedString {
509511
try AttributedString(markdown: self, options: .init(allowsExtendedAttributes: allowsExtendedAttributes, interpretedSyntax: interpret, failurePolicy: .returnPartiallyParsedIfPossible, languageCode: languageCode))
510512
}
511-
#endif
512513
}
513514
#endif
514515

Sources/FairCore/Net.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ extension URLRequest {
131131
}
132132

133133
public extension URLRequest {
134-
#if swift(>=5.5)
135134
/// Downloads the URL and verifies the HTTP success code and, optionally, the validity of the
136135
/// SHA-256 hash included as the URL's fragment.
137136
///
@@ -154,7 +153,6 @@ public extension URLRequest {
154153

155154
return data
156155
}
157-
#endif
158156
}
159157

160158
extension URLResponse {
@@ -398,7 +396,6 @@ extension URLRequest {
398396
}
399397
}
400398

401-
#if swift(>=5.5)
402399
extension URLSession {
403400
/// Issues a `HEAD` request for the given URL and returns the response
404401
public func fetchHEAD(url: URL, cachePolicy: URLRequest.CachePolicy) async throws -> URLResponse? {
@@ -567,4 +564,3 @@ extension URLSession {
567564
}
568565
}
569566
}
570-
#endif // swift(>=5.5)

Sources/FairCore/Zip.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ import Glibc
88
import var Glibc.S_IFREG
99
import var Glibc.S_IFDIR
1010
import var Glibc.S_IFLNK
11+
#elseif canImport(Musl)
12+
import Musl
13+
import var Musl.S_IFREG
14+
import var Musl.S_IFDIR
15+
import var Musl.S_IFLNK
1116
#endif
12-
1317
import CZLib
1418
#if canImport(zlib)
1519
import zlib

Sources/FairExpo/Documentation.docc/Documentation.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

Sources/FairExpo/EndpointService.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import Foundation
2+
#if canImport(FoundationNetworking)
3+
import FoundationNetworking
4+
#endif
25
import FairCore
36

47
/// A service that converts actions and parameters into an endpoint URL
@@ -65,11 +68,10 @@ public extension EndpointService {
6568
}
6669

6770
extension EndpointService {
68-
#if swift(>=5.5)
6971
/// Issue a request while waiting for the expected request
7072
/// Note: currently unused
7173
public func requestAsyncWithRateLimit<A: APIRequest>(_ request: A, cache: URLRequest.CachePolicy? = nil, retry: Bool = true) async throws -> A.Response where A.Service == Self {
72-
let (data, response) = try await session.data(for: buildRequest(for: request, cache: cache), delegate: nil)
74+
let (data, response) = try await session.data(for: buildRequest(for: request, cache: cache))
7375

7476
// check response headers for rate-limiting
7577
if let response = response as? HTTPURLResponse {
@@ -92,7 +94,6 @@ extension EndpointService {
9294
}
9395
return try decode(data: data)
9496
}
95-
#endif
9697
}
9798

9899
extension EndpointService {

Tests/FairCoreTests/FairCoreTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,13 @@ final class FairCoreTests: XCTestCase {
266266

267267
try await readURLAsync(url: URL(string: "https://www.example.org")!, expectRedirect: 0)
268268

269-
try await readURLAsync(url: URL(string: "https://github.com/fair-ground/Fair")!, expectRedirect: 0)
270-
try await readURLAsync(url: URL(string: "https://github.com/fair-ground/Fair.git")!, expectRedirect: 1)
269+
try await readURLAsync(url: URL(string: "https://github.com/appfair/Fair")!, expectRedirect: 0)
270+
try await readURLAsync(url: URL(string: "https://github.com/appfair/Fair.git")!, expectRedirect: 1)
271271

272272
// two separate redirects: www.github.com -> github.com and Fair.git to Fair/
273-
try await readURLAsync(url: URL(string: "https://www.github.com/fair-ground/Fair.git")!, expectRedirect: 2, expectChallenge: 2)
273+
try await readURLAsync(url: URL(string: "https://www.github.com/appfair/Fair.git")!, expectRedirect: 2, expectChallenge: 2)
274274

275-
try await readURLAsync(url: URL(string: "https://github.com/fair-ground/UNKNOWN_REPO")!, expectRedirect: 0, expectChallenge: 1) // unknown repositories response with a challenge
275+
try await readURLAsync(url: URL(string: "https://github.com/appfair/UNKNOWN_REPO")!, expectRedirect: 0, expectChallenge: 1) // unknown repositories response with a challenge
276276
}
277277

278278
func readURLAsync(url: URL, expectRedirect: Int? = nil, expectChallenge: Int? = nil) async throws {
-28 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)