Skip to content

Commit

Permalink
Merge pull request #29 from writefreely/fix-build-errors
Browse files Browse the repository at this point in the history
Fix build errors and add back testing files
  • Loading branch information
AngeloStavrow authored May 25, 2021
2 parents 7fd1c6a + dce40da commit 3f05bc1
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/WriteFreely/WFClient+Templates.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extension WFClient {
return
}

guard let response = response as? HTTPURLResponse, response.statusCode == 200 else {
guard let unwrappedResponse = response as? HTTPURLResponse, unwrappedResponse.statusCode == 200 else {
if let response = response as? HTTPURLResponse {
completion(.failure(WFError(rawValue: response.statusCode) ?? .invalidResponse))
} else {
Expand Down Expand Up @@ -57,7 +57,7 @@ extension WFClient {
return
}

guard let response = response as? HTTPURLResponse, response.statusCode == statusCode else {
guard let unwrappedResponse = response as? HTTPURLResponse, unwrappedResponse.statusCode == statusCode else {
if let response = response as? HTTPURLResponse {
completion(.failure(WFError(rawValue: response.statusCode) ?? .invalidResponse))
} else {
Expand Down Expand Up @@ -92,7 +92,7 @@ extension WFClient {
return
}

guard let response = response as? HTTPURLResponse, response.statusCode == 204 else {
guard let unwrappedResponse = response as? HTTPURLResponse, unwrappedResponse.statusCode == 204 else {
if let response = response as? HTTPURLResponse {
completion(.failure(WFError(rawValue: response.statusCode) ?? .invalidResponse))
} else {
Expand Down
7 changes: 7 additions & 0 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import XCTest

import WriteFreelyTests

var tests = [XCTestCaseEntry]()
tests += WriteFreelyTests.allTests()
XCTMain(tests)
15 changes: 15 additions & 0 deletions Tests/WriteFreelyTests/WriteFreelyTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import XCTest
@testable import WriteFreely

final class WriteFreelyTests: XCTestCase {
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct
// results.
XCTAssertEqual(true, !false)
}

static var allTests = [
("testExample", testExample),
]
}
9 changes: 9 additions & 0 deletions Tests/WriteFreelyTests/XCTestManifests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import XCTest

#if !canImport(ObjectiveC)
public func allTests() -> [XCTestCaseEntry] {
return [
testCase(WriteFreelyTests.allTests),
]
}
#endif

0 comments on commit 3f05bc1

Please sign in to comment.