Skip to content

Commit

Permalink
Merge pull request #8 from venmo/swift4.2
Browse files Browse the repository at this point in the history
Swift 4.2
  • Loading branch information
dgallagher-venmo authored Sep 13, 2018
2 parents e7d1b13 + 876e0ec commit abb57b6
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 96 deletions.
2 changes: 1 addition & 1 deletion Example/Cartfile.private
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "venmo/QuizTrain" ~> 1.1.1
github "venmo/QuizTrain" ~> 1.2.0
2 changes: 1 addition & 1 deletion Example/Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "venmo/QuizTrain" "v1.1.1"
github "venmo/QuizTrain" "v1.2.0"
8 changes: 2 additions & 6 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand Down Expand Up @@ -626,6 +627,7 @@
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 4.2;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -642,7 +644,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = QuizTrain.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -659,7 +660,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = QuizTrain.Example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -678,7 +678,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = QuizTrain.ExampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example";
};
Expand All @@ -698,7 +697,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = QuizTrain.ExampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example";
};
Expand All @@ -717,7 +715,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = QuizTrain.ExampleUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = Example;
};
Expand All @@ -736,7 +733,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = QuizTrain.ExampleUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = Example;
};
Expand Down
2 changes: 1 addition & 1 deletion Example/Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
private func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
return true
}

Expand Down
15 changes: 10 additions & 5 deletions Example/ExampleTests/ExampleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,34 @@ import XCTest
class ExampleTests: XCTestCase {

func testWhichPasses() {
XCTContext.runActivity(testing: 10011) { activity in // TODO: Replace this placeholder caseId with one from your project.
#error("Replace the placeholder caseId below with one from your project. Then comment out this macro.")
XCTContext.runActivity(testing: 10011) { activity in
XCTAssertTrue(true, "The value is not true.")
}
}

func testWhichFails() {
XCTContext.runActivity(testing: 10022) { activity in // TODO: Replace this placeholder caseId with one from your project.
#error("Replace the placeholder caseId below with one from your project. Then comment out this macro.")
XCTContext.runActivity(testing: 10022) { activity in
XCTAssertTrue(false, "The value is not true.")
}
}

func testWithPassingAndFailingAssertions() {

XCTContext.runActivity(testing: 10033) { activity in // TODO: Replace this placeholder caseId with one from your project.
#error("Replace the placeholder caseId below with one from your project. Then comment out this macro.")
XCTContext.runActivity(testing: 10033) { activity in

XCTAssertTrue(true, "The value is not true.")

XCTContext.runActivity(testing: [10044, 10055]) { activity in // TODO: Replace these placeholder caseIds with some from your project.
#error("Replace the placeholder caseIds below with ones from your project. Then comment out this macro.")
XCTContext.runActivity(testing: [10044, 10055]) { activity in
XCTAssertTrue(false, "The value is not true.")
XCTAssertFalse(false, "The value is not false.")
}

XCTContext.runActivity(testing: [10066, 10077, 10088]) { activity in // TODO: Replace these placeholder with some from your project.
#error("Replace the placeholder caseIds below with ones from your project. Then comment out this macro.")
XCTContext.runActivity(testing: [10066, 10077, 10088]) { activity in
XCTAssertTrue(true, "The value is not true.")
}
}
Expand Down
15 changes: 10 additions & 5 deletions Example/ExampleUITests/ExampleUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,38 @@ class ExampleUITests: XCTestCase {
}

func testWhichPasses() {
XCTContext.runActivity(testing: 20011) { activity in // TODO: Replace this placeholder caseId with one from your project.
#error("Replace the placeholder caseId below with one from your project. Then comment out this macro.")
XCTContext.runActivity(testing: 20011) { activity in
let query = app.staticTexts["exampleLabel"]
XCTAssertTrue(query.exists, query.debugDescription)
}
}

func testWhichFails() {
XCTContext.runActivity(testing: 20022) { activity in // TODO: Replace this placeholder caseId with one from your project.
#error("Replace the placeholder caseId below with one from your project. Then comment out this macro.")
XCTContext.runActivity(testing: 20022) { activity in
let query = app.staticTexts["non-existant accessibility identifier"]
XCTAssertTrue(query.exists, query.debugDescription)
}
}

func testWithPassingAndFailingAssertions() {

XCTContext.runActivity(testing: 20033) { activity in // TODO: Replace this placeholder caseId with one from your project.
#error("Replace the placeholder caseId below with one from your project. Then comment out this macro.")
XCTContext.runActivity(testing: 20033) { activity in

let queryA = app.staticTexts["exampleLabel"]
XCTAssertTrue(queryA.exists, queryA.debugDescription)

XCTContext.runActivity(testing: [20044, 20055]) { activity in // TODO: Replace these placeholder caseIds with some from your project.
#error("Replace the placeholder caseIds below with ones from your project. Then comment out this macro.")
XCTContext.runActivity(testing: [20044, 20055]) { activity in
let queryB = app.staticTexts["non-existant accessibility identifier"]
XCTAssertTrue(queryB.exists, queryB.debugDescription)
XCTAssertFalse(queryB.exists, queryB.debugDescription)
}

XCTContext.runActivity(testing: [20066, 20077, 20088]) { activity in // TODO: Replace these placeholder with some from your project.
#error("Replace the placeholder caseIds below with ones from your project. Then comment out this macro.")
XCTContext.runActivity(testing: [20066, 20077, 20088]) { activity in
let queryC = app.staticTexts["exampleLabel"]
XCTAssertEqual(queryC.label, "QuizTrain Example", queryC.debugDescription)
}
Expand Down
2 changes: 1 addition & 1 deletion Example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The Example project is open source software released under the MIT License. See

## Setup

Before building and running tests there are some placeholder values you must update in code marked as `TODO:`.
Before building and running tests there are some placeholder values you must update in code marked with Swift `#error` macros. After updating them comment out the macros.

- `TestManager.swift`
- Update `let objectAPI = QuizTrain.ObjectAPI(...)` with valid credentials and other info for your TestRail instance.
Expand Down
2 changes: 1 addition & 1 deletion Example/Shared/QuizTrainManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ extension QuizTrainManager {
print("Plan creation completed. \(plan.url)")

guard let planEntries = plan.entries, planEntries.count > 0 else {
print("Aborting: There are no entries in the plan: \(plan)")
print("Aborting: There are no entries in the plan: \(String(describing: plan))")
return
}

Expand Down
6 changes: 4 additions & 2 deletions Example/Shared/TestManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ final class TestManager: NSObject {
defer { print("\n====================================\n") }

print("QuizTrainManager setup started.")
let objectAPI = QuizTrain.ObjectAPI(username: "[email protected]", secret: "YOUR_TESTRAIL_PASSWORD_OR_API_KEY", hostname: "YOURINSTANCE.testrail.net", port: 443, scheme: "https") // TODO: Update these arguments for your TestRail instance.
#error("Update these ObjectAPI arguments below for your TestRail instance. Then comment out this macro.")
let objectAPI = QuizTrain.ObjectAPI(username: "[email protected]", secret: "YOUR_TESTRAIL_PASSWORD_OR_API_KEY", hostname: "YOURINSTANCE.testrail.net", port: 443, scheme: "https")
var quizTrainManager: QuizTrainManager!
let group = DispatchGroup()
group.enter()
DispatchQueue.global().async {
QuizTrainProject.populatedProject(forProjectId: 99999, objectAPI: objectAPI) { (outcome) in // TODO: Replace the projectId with one from your TestRail instance.
#error("Replace the projectId below with one from your TestRail instance. Then comment out this macro.")
QuizTrainProject.populatedProject(forProjectId: 99999, objectAPI: objectAPI) { (outcome) in
switch outcome {
case .failed(let error):
print("QuizTrainManager setup failed: \(error)")
Expand Down
16 changes: 2 additions & 14 deletions QuizTrain.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2421,6 +2421,7 @@
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand Down Expand Up @@ -2474,6 +2475,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand All @@ -2498,7 +2500,6 @@
PRODUCT_NAME = QuizTrain;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -2520,7 +2521,6 @@
PRODUCT_BUNDLE_IDENTIFIER = venmo.QuizTrain;
PRODUCT_NAME = QuizTrain;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -2534,7 +2534,6 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = venmo.QuizTrainTests;
PRODUCT_NAME = QuizTrainTests;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -2548,7 +2547,6 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = venmo.QuizTrainTests;
PRODUCT_NAME = QuizTrainTests;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -2570,7 +2568,6 @@
PRODUCT_NAME = QuizTrain;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 3.0;
};
Expand All @@ -2593,7 +2590,6 @@
PRODUCT_NAME = QuizTrain;
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 3.0;
};
Expand All @@ -2615,7 +2611,6 @@
PRODUCT_NAME = QuizTrain;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
Expand All @@ -2637,7 +2632,6 @@
PRODUCT_NAME = QuizTrain;
SDKROOT = appletvos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
Expand All @@ -2653,7 +2647,6 @@
PRODUCT_BUNDLE_IDENTIFIER = venmo.QuizTrainTests;
PRODUCT_NAME = QuizTrainTests;
SDKROOT = appletvos;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 11.2;
};
Expand All @@ -2669,7 +2662,6 @@
PRODUCT_BUNDLE_IDENTIFIER = venmo.QuizTrainTests;
PRODUCT_NAME = QuizTrainTests;
SDKROOT = appletvos;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 11.2;
};
Expand All @@ -2694,7 +2686,6 @@
PRODUCT_NAME = QuizTrain;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -2717,7 +2708,6 @@
PRODUCT_NAME = QuizTrain;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand All @@ -2734,7 +2724,6 @@
PRODUCT_BUNDLE_IDENTIFIER = venmo.QuizTrainTests;
PRODUCT_NAME = QuizTrainTests;
SDKROOT = macosx;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -2751,7 +2740,6 @@
PRODUCT_BUNDLE_IDENTIFIER = venmo.QuizTrainTests;
PRODUCT_NAME = QuizTrainTests;
SDKROOT = macosx;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion QuizTrain/Network/API.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ final public class API {
return request
}

// MARL: - Errors
// MARK: - Errors

public enum RequestError: Error {
case error(request: URLRequest, error: Error)
Expand Down
Loading

0 comments on commit abb57b6

Please sign in to comment.