Skip to content

Commit 3f05bc1

Browse files
Merge pull request #29 from writefreely/fix-build-errors
Fix build errors and add back testing files
2 parents 7fd1c6a + dce40da commit 3f05bc1

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

Sources/WriteFreely/WFClient+Templates.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extension WFClient {
1717
return
1818
}
1919

20-
guard let response = response as? HTTPURLResponse, response.statusCode == 200 else {
20+
guard let unwrappedResponse = response as? HTTPURLResponse, unwrappedResponse.statusCode == 200 else {
2121
if let response = response as? HTTPURLResponse {
2222
completion(.failure(WFError(rawValue: response.statusCode) ?? .invalidResponse))
2323
} else {
@@ -57,7 +57,7 @@ extension WFClient {
5757
return
5858
}
5959

60-
guard let response = response as? HTTPURLResponse, response.statusCode == statusCode else {
60+
guard let unwrappedResponse = response as? HTTPURLResponse, unwrappedResponse.statusCode == statusCode else {
6161
if let response = response as? HTTPURLResponse {
6262
completion(.failure(WFError(rawValue: response.statusCode) ?? .invalidResponse))
6363
} else {
@@ -92,7 +92,7 @@ extension WFClient {
9292
return
9393
}
9494

95-
guard let response = response as? HTTPURLResponse, response.statusCode == 204 else {
95+
guard let unwrappedResponse = response as? HTTPURLResponse, unwrappedResponse.statusCode == 204 else {
9696
if let response = response as? HTTPURLResponse {
9797
completion(.failure(WFError(rawValue: response.statusCode) ?? .invalidResponse))
9898
} else {

Tests/LinuxMain.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import XCTest
2+
3+
import WriteFreelyTests
4+
5+
var tests = [XCTestCaseEntry]()
6+
tests += WriteFreelyTests.allTests()
7+
XCTMain(tests)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import XCTest
2+
@testable import WriteFreely
3+
4+
final class WriteFreelyTests: XCTestCase {
5+
func testExample() {
6+
// This is an example of a functional test case.
7+
// Use XCTAssert and related functions to verify your tests produce the correct
8+
// results.
9+
XCTAssertEqual(true, !false)
10+
}
11+
12+
static var allTests = [
13+
("testExample", testExample),
14+
]
15+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import XCTest
2+
3+
#if !canImport(ObjectiveC)
4+
public func allTests() -> [XCTestCaseEntry] {
5+
return [
6+
testCase(WriteFreelyTests.allTests),
7+
]
8+
}
9+
#endif

0 commit comments

Comments
 (0)