Skip to content

Commit 28ed152

Browse files
committed
Convert StringExtTests
1 parent 8c05a7c commit 28ed152

File tree

1 file changed

+33
-35
lines changed

1 file changed

+33
-35
lines changed

Tests/AppTests/StringExtTests.swift

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,61 +13,59 @@
1313
// limitations under the License.
1414

1515
import Foundation
16-
import XCTest
1716

1817
@testable import App
1918

19+
import Testing
2020

21-
final class StringExtTests: XCTestCase {
2221

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 {
2723

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")
3132
}
3233

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"
3737
)
3838

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"
4241
)
4342
}
4443

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"
4947
)
5048
}
5149

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")
5755
}
5856

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 ")
6765
}
6866

69-
func test_sha256Checksum() throws {
70-
XCTAssertEqual("foo".sha256Checksum, "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae")
67+
@Test func sha256Checksum() throws {
68+
#expect("foo".sha256Checksum == "2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae")
7169
}
7270

7371
}

0 commit comments

Comments
 (0)