From 03d3bcefed27c5e5c6d7a551f5d27ec1edf046df Mon Sep 17 00:00:00 2001 From: Stuart Montgomery Date: Fri, 1 Aug 2025 14:28:19 -0500 Subject: [PATCH] Showcase usage of Swift Testing instead of XCTest in example test file --- Tests/MyLibraryTests/MyLibraryTests.swift | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Tests/MyLibraryTests/MyLibraryTests.swift b/Tests/MyLibraryTests/MyLibraryTests.swift index 5f3099b..de95a35 100644 --- a/Tests/MyLibraryTests/MyLibraryTests.swift +++ b/Tests/MyLibraryTests/MyLibraryTests.swift @@ -10,14 +10,16 @@ // //===-------------------------------------------------------------------- +import Testing @testable import MyLibrary -import XCTest -final class MyLibraryTests: XCTestCase { - func testEmail() throws { +struct MyLibraryTests { + @Test func email() throws { let email = try Email("john.appleseed@apple.com") - XCTAssertEqual(email.description, "john.appleseed@apple.com") + #expect(email.description == "john.appleseed@apple.com") - XCTAssertThrowsError(try Email("invalid")) + #expect(throws: (any Error).self) { + try Email("invalid") + } } }