|
13 | 13 | // limitations under the License. |
14 | 14 |
|
15 | 15 | import Foundation |
16 | | -import XCTest |
17 | 16 |
|
18 | 17 | @testable import App |
19 | 18 |
|
| 19 | +import Testing |
20 | 20 |
|
21 | | -final class StringExtTests: XCTestCase { |
22 | 21 |
|
23 | | - func test_pluralised() throws { |
24 | | - XCTAssertEqual("version".pluralized(for: 0), "versions") |
25 | | - XCTAssertEqual("version".pluralized(for: 1), "version") |
26 | | - XCTAssertEqual("version".pluralized(for: 2), "versions") |
| 22 | +@Suite struct StringExtTests { |
27 | 23 |
|
28 | | - XCTAssertEqual("library".pluralized(for: 0, plural: "libraries"), "libraries") |
29 | | - XCTAssertEqual("library".pluralized(for: 1, plural: "libraries"), "library") |
30 | | - XCTAssertEqual("library".pluralized(for: 2, plural: "libraries"), "libraries") |
| 24 | + @Test func pluralised() throws { |
| 25 | + #expect("version".pluralized(for: 0) == "versions") |
| 26 | + #expect("version".pluralized(for: 1) == "version") |
| 27 | + #expect("version".pluralized(for: 2) == "versions") |
| 28 | + |
| 29 | + #expect("library".pluralized(for: 0, plural: "libraries") == "libraries") |
| 30 | + #expect("library".pluralized(for: 1, plural: "libraries") == "library") |
| 31 | + #expect("library".pluralized(for: 2, plural: "libraries") == "libraries") |
31 | 32 | } |
32 | 33 |
|
33 | | - func testDroppingGitSuffix() { |
34 | | - XCTAssertEqual( |
35 | | - "https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server".droppingGitExtension, |
36 | | - "https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server" |
| 34 | + @Test func droppingGitSuffix() { |
| 35 | + #expect( |
| 36 | + "https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server".droppingGitExtension == "https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server" |
37 | 37 | ) |
38 | 38 |
|
39 | | - XCTAssertEqual( |
40 | | - "https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server.git".droppingGitExtension, |
41 | | - "https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server" |
| 39 | + #expect( |
| 40 | + "https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server.git".droppingGitExtension == "https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server" |
42 | 41 | ) |
43 | 42 | } |
44 | 43 |
|
45 | | - func testDroppingGitHubPrefix() { |
46 | | - XCTAssertEqual( |
47 | | - "https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server".droppingGithubComPrefix, |
48 | | - "SwiftPackageIndex/SwiftPackageIndex-Server" |
| 44 | + @Test func droppingGitHubPrefix() { |
| 45 | + #expect( |
| 46 | + "https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server".droppingGithubComPrefix == "SwiftPackageIndex/SwiftPackageIndex-Server" |
49 | 47 | ) |
50 | 48 | } |
51 | 49 |
|
52 | | - func testTrimming() { |
53 | | - XCTAssertEqual("".trimmed, nil) |
54 | | - XCTAssertEqual(" ".trimmed, nil) |
55 | | - XCTAssertEqual(" string ".trimmed, "string") |
56 | | - XCTAssertEqual("string".trimmed, "string") |
| 50 | + @Test func trimming() { |
| 51 | + #expect("".trimmed == nil) |
| 52 | + #expect(" ".trimmed == nil) |
| 53 | + #expect(" string ".trimmed == "string") |
| 54 | + #expect("string".trimmed == "string") |
57 | 55 | } |
58 | 56 |
|
59 | | - func test_removingSuffix() throws { |
60 | | - XCTAssertEqual("".removingSuffix(""), "") |
61 | | - XCTAssertEqual("".removingSuffix("bob"), "") |
62 | | - XCTAssertEqual("bob".removingSuffix("bob"), "") |
63 | | - XCTAssertEqual("bobby and bob".removingSuffix("bob"), "bobby and ") |
64 | | - XCTAssertEqual("bobby and bob ".removingSuffix("bob"), "bobby and bob ") |
65 | | - XCTAssertEqual("Bobby and Bob".removingSuffix("bob"), "Bobby and ") |
66 | | - XCTAssertEqual("bobby and bob".removingSuffix("Bob"), "bobby and ") |
| 57 | + @Test func removingSuffix() throws { |
| 58 | + #expect("".removingSuffix("") == "") |
| 59 | + #expect("".removingSuffix("bob") == "") |
| 60 | + #expect("bob".removingSuffix("bob") == "") |
| 61 | + #expect("bobby and bob".removingSuffix("bob") == "bobby and ") |
| 62 | + #expect("bobby and bob ".removingSuffix("bob") == "bobby and bob ") |
| 63 | + #expect("Bobby and Bob".removingSuffix("bob") == "Bobby and ") |
| 64 | + #expect("bobby and bob".removingSuffix("Bob") == "bobby and ") |
67 | 65 | } |
68 | 66 |
|
69 | | - func test_sha256Checksum() throws { |
70 | | - XCTAssertEqual("foo".sha256Checksum, "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae") |
| 67 | + @Test func sha256Checksum() throws { |
| 68 | + #expect("foo".sha256Checksum == "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae") |
71 | 69 | } |
72 | 70 |
|
73 | 71 | } |
0 commit comments