Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update documentation and examples to use Swift Testing #3413

Merged
merged 25 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions Examples/CaseStudies/CaseStudies.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,6 @@
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.tvOSCaseStudies;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
};
name = Debug;
Expand All @@ -872,7 +871,6 @@
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.tvOSCaseStudies;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
};
name = Release;
Expand All @@ -891,7 +889,6 @@
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.tvOSCaseStudiesTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/tvOSCaseStudies.app/tvOSCaseStudies";
};
Expand All @@ -911,7 +908,6 @@
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.tvOSCaseStudiesTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/tvOSCaseStudies.app/tvOSCaseStudies";
};
Expand All @@ -931,7 +927,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.UIKitCaseStudies;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -950,7 +945,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.UIKitCaseStudies;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -968,7 +962,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.UIKitCaseStudiesTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UIKitCaseStudies.app/UIKitCaseStudies";
};
Expand All @@ -987,7 +980,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.UIKitCaseStudiesTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/UIKitCaseStudies.app/UIKitCaseStudies";
};
Expand Down Expand Up @@ -1053,6 +1045,7 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
};
name = Debug;
};
Expand Down Expand Up @@ -1109,6 +1102,7 @@
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_STRICT_CONCURRENCY = complete;
SWIFT_VERSION = 6.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -1126,7 +1120,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.SwiftUICaseStudies;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -1144,7 +1137,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.SwiftUICaseStudies;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -1162,7 +1154,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.SwiftUICaseStudiesTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftUICaseStudies.app/SwiftUICaseStudies";
};
Expand All @@ -1181,7 +1172,6 @@
);
PRODUCT_BUNDLE_IDENTIFIER = co.pointfree.SwiftUICaseStudiesTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 6.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftUICaseStudies.app/SwiftUICaseStudies";
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import ComposableArchitecture
import XCTest
import Testing

@testable import SwiftUICaseStudies

final class AlertsAndConfirmationDialogsTests: XCTestCase {
func testAlert() async {
let store = await TestStore(initialState: AlertAndConfirmationDialog.State()) {
@MainActor
struct AlertsAndConfirmationDialogsTests {
@Test
func alert() async {
let store = TestStore(initialState: AlertAndConfirmationDialog.State()) {
AlertAndConfirmationDialog()
}

Expand All @@ -32,8 +34,9 @@ final class AlertsAndConfirmationDialogsTests: XCTestCase {
}
}

func testConfirmationDialog() async {
let store = await TestStore(initialState: AlertAndConfirmationDialog.State()) {
@Test
func confirmationDialog() async {
let store = TestStore(initialState: AlertAndConfirmationDialog.State()) {
AlertAndConfirmationDialog()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import Clocks
import ComposableArchitecture
import XCTest
import Testing

@testable import SwiftUICaseStudies

final class AnimationTests: XCTestCase {
func testRainbow() async {
@MainActor
struct AnimationTests {
@Test
func rainbow() async {
let clock = TestClock()

let store = await TestStore(initialState: Animations.State()) {
let store = TestStore(initialState: Animations.State()) {
Animations()
} withDependencies: {
$0.continuousClock = clock
Expand Down Expand Up @@ -57,10 +59,11 @@ final class AnimationTests: XCTestCase {
await clock.run()
}

func testReset() async {
@Test
func reset() async {
let clock = TestClock()

let store = await TestStore(initialState: Animations.State()) {
let store = TestStore(initialState: Animations.State()) {
Animations()
} withDependencies: {
$0.continuousClock = clock
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import ComposableArchitecture
import XCTest
import Testing

@testable import SwiftUICaseStudies

final class BindingFormTests: XCTestCase {
func testBasics() async {
let store = await TestStore(initialState: BindingForm.State()) {
@MainActor
struct BindingFormTests {
@Test
func basics() async {
let store = TestStore(initialState: BindingForm.State()) {
BindingForm()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import ComposableArchitecture
import XCTest
import Testing

@testable import SwiftUICaseStudies

final class SharedStateFileStorageTests: XCTestCase {
func testTabSelection() async {
let store = await TestStore(initialState: SharedStateFileStorage.State()) {
@MainActor
struct SharedStateFileStorageTests {
@Test
func tabSelection() async {
let store = TestStore(initialState: SharedStateFileStorage.State()) {
SharedStateFileStorage()
}

Expand All @@ -17,8 +19,9 @@ final class SharedStateFileStorageTests: XCTestCase {
}
}

func testSharedCounts() async {
let store = await TestStore(initialState: SharedStateFileStorage.State()) {
@Test
func sharedCounts() async {
let store = TestStore(initialState: SharedStateFileStorage.State()) {
SharedStateFileStorage()
}

Expand All @@ -35,8 +38,9 @@ final class SharedStateFileStorageTests: XCTestCase {
}
}

func testAlert() async {
let store = await TestStore(initialState: SharedStateFileStorage.State()) {
@Test
func alert() async {
let store = TestStore(initialState: SharedStateFileStorage.State()) {
SharedStateFileStorage()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import ComposableArchitecture
import XCTest
import Testing

@testable import SwiftUICaseStudies

final class SharedStateInMemoryTests: XCTestCase {
func testTabSelection() async {
let store = await TestStore(initialState: SharedStateInMemory.State()) {
@MainActor
struct SharedStateInMemoryTests {
@Test
func tabSelection() async {
let store = TestStore(initialState: SharedStateInMemory.State()) {
SharedStateInMemory()
}

Expand All @@ -17,8 +19,9 @@ final class SharedStateInMemoryTests: XCTestCase {
}
}

func testSharedCounts() async {
let store = await TestStore(initialState: SharedStateInMemory.State()) {
@Test
func sharedCounts() async {
let store = TestStore(initialState: SharedStateInMemory.State()) {
SharedStateInMemory()
}

Expand All @@ -35,8 +38,9 @@ final class SharedStateInMemoryTests: XCTestCase {
}
}

func testAlert() async {
let store = await TestStore(initialState: SharedStateInMemory.State()) {
@Test
func alert() async {
let store = TestStore(initialState: SharedStateInMemory.State()) {
SharedStateInMemory()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import ComposableArchitecture
import XCTest
import Testing

@testable import SwiftUICaseStudies

final class SharedStateUserDefaultsTests: XCTestCase {
func testTabSelection() async {
let store = await TestStore(initialState: SharedStateUserDefaults.State()) {
@MainActor
struct SharedStateUserDefaultsTests {
@Test
func tabSelection() async {
let store = TestStore(initialState: SharedStateUserDefaults.State()) {
SharedStateUserDefaults()
}

Expand All @@ -17,8 +19,9 @@ final class SharedStateUserDefaultsTests: XCTestCase {
}
}

func testSharedCounts() async {
let store = await TestStore(initialState: SharedStateUserDefaults.State()) {
@Test
func sharedCounts() async {
let store = TestStore(initialState: SharedStateUserDefaults.State()) {
SharedStateUserDefaults()
}

Expand All @@ -35,8 +38,9 @@ final class SharedStateUserDefaultsTests: XCTestCase {
}
}

func testAlert() async {
let store = await TestStore(initialState: SharedStateUserDefaults.State()) {
@Test
func alert() async {
let store = TestStore(initialState: SharedStateUserDefaults.State()) {
SharedStateUserDefaults()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import ComposableArchitecture
import XCTest
import Testing

@testable import SwiftUICaseStudies

final class EffectsBasicsTests: XCTestCase {
func testCountDown() async {
let store = await TestStore(initialState: EffectsBasics.State()) {
@MainActor
struct EffectsBasicsTests {
@Test
func countDown() async {
let store = TestStore(initialState: EffectsBasics.State()) {
EffectsBasics()
} withDependencies: {
$0.continuousClock = ImmediateClock()
Expand All @@ -19,8 +21,9 @@ final class EffectsBasicsTests: XCTestCase {
}
}

func testNumberFact() async {
let store = await TestStore(initialState: EffectsBasics.State()) {
@Test
func numberFact() async {
let store = TestStore(initialState: EffectsBasics.State()) {
EffectsBasics()
} withDependencies: {
$0.factClient.fetch = { "\($0) is a good number Brent" }
Expand All @@ -39,8 +42,9 @@ final class EffectsBasicsTests: XCTestCase {
}
}

@Test
func testDecrement() async {
let store = await TestStore(initialState: EffectsBasics.State()) {
let store = TestStore(initialState: EffectsBasics.State()) {
EffectsBasics()
} withDependencies: {
$0.continuousClock = ImmediateClock()
Expand All @@ -54,8 +58,9 @@ final class EffectsBasicsTests: XCTestCase {
}
}

@Test
func testDecrementCancellation() async {
let store = await TestStore(initialState: EffectsBasics.State()) {
let store = TestStore(initialState: EffectsBasics.State()) {
EffectsBasics()
} withDependencies: {
$0.continuousClock = TestClock()
Expand Down
Loading
Loading