Skip to content

Commit fe8d170

Browse files
committed
Convert DefaultStringInterpolationTests
1 parent 1f2e89e commit fe8d170

File tree

1 file changed

+29
-28
lines changed

1 file changed

+29
-28
lines changed

Tests/AppTests/DefaultStringInterpolationTests.swift

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
import Foundation
16+
1517
@testable import App
1618

17-
import Foundation
18-
import XCTest
19+
import Testing
1920

2021

21-
class DefaultStringInterpolationTests: XCTestCase {
22+
@Suite struct DefaultStringInterpolationTests {
2223

23-
func test_inWords_timeDifference() throws {
24+
@Test func inWords_timeDifference() throws {
2425
let m = 60
2526
let H = 60*m
2627
let d = 24*H
@@ -44,39 +45,39 @@ class DefaultStringInterpolationTests: XCTestCase {
4445
(5*Y + 3*M, "5 years"),
4546
]
4647
for (delta, exp) in tests {
47-
XCTAssertEqual("\(inWords: TimeInterval(delta))", exp, "delta was: \(delta)")
48+
#expect("\(inWords: TimeInterval(delta))" == exp, "delta was: \(delta)")
4849
}
4950
}
5051

51-
func test_relativeDate_interpolation() throws {
52+
@Test func relativeDate_interpolation() throws {
5253
let now = Date()
53-
XCTAssertEqual("\(date: now.addingTimeInterval(5), relativeTo: now)", "in less than a minute")
54-
XCTAssertEqual("\(date: now.addingTimeInterval(-5), relativeTo: now)", "less than a minute ago")
54+
#expect("\(date: now.addingTimeInterval(5), relativeTo: now)" == "in less than a minute")
55+
#expect("\(date: now.addingTimeInterval(-5), relativeTo: now)" == "less than a minute ago")
5556
}
5657

57-
func test_kiloPostfixedQuantity_interpolation() throws {
58-
XCTAssertEqual("\(kiloPostfixedQuantity: 1)", "1")
59-
XCTAssertEqual("\(kiloPostfixedQuantity: 10)", "10")
60-
XCTAssertEqual("\(kiloPostfixedQuantity: 100)", "100")
61-
XCTAssertEqual("\(kiloPostfixedQuantity: 1_000)", "1.0k")
62-
XCTAssertEqual("\(kiloPostfixedQuantity: 1_449)", "1.4k")
63-
XCTAssertEqual("\(kiloPostfixedQuantity: 1_450)", "1.5k")
64-
XCTAssertEqual("\(kiloPostfixedQuantity: 1_500)", "1.5k")
65-
XCTAssertEqual("\(kiloPostfixedQuantity: 9_949)", "9.9k")
66-
XCTAssertEqual("\(kiloPostfixedQuantity: 9_950)", "10.0k")
67-
XCTAssertEqual("\(kiloPostfixedQuantity: 9_951)", "10.0k")
68-
XCTAssertEqual("\(kiloPostfixedQuantity: 10_000)", "10.0k")
58+
@Test func kiloPostfixedQuantity_interpolation() throws {
59+
#expect("\(kiloPostfixedQuantity: 1)" == "1")
60+
#expect("\(kiloPostfixedQuantity: 10)" == "10")
61+
#expect("\(kiloPostfixedQuantity: 100)" == "100")
62+
#expect("\(kiloPostfixedQuantity: 1_000)" == "1.0k")
63+
#expect("\(kiloPostfixedQuantity: 1_449)" == "1.4k")
64+
#expect("\(kiloPostfixedQuantity: 1_450)" == "1.5k")
65+
#expect("\(kiloPostfixedQuantity: 1_500)" == "1.5k")
66+
#expect("\(kiloPostfixedQuantity: 9_949)" == "9.9k")
67+
#expect("\(kiloPostfixedQuantity: 9_950)" == "10.0k")
68+
#expect("\(kiloPostfixedQuantity: 9_951)" == "10.0k")
69+
#expect("\(kiloPostfixedQuantity: 10_000)" == "10.0k")
6970

70-
XCTAssertEqual("\(kiloPostfixedQuantity: 12_345)", "12.3k")
71-
XCTAssertEqual("\(kiloPostfixedQuantity: 54_321)", "54.3k")
72-
XCTAssertEqual("\(kiloPostfixedQuantity: 123_456)", "123.5k")
73-
XCTAssertEqual("\(kiloPostfixedQuantity: 654_321)", "654.3k")
71+
#expect("\(kiloPostfixedQuantity: 12_345)" == "12.3k")
72+
#expect("\(kiloPostfixedQuantity: 54_321)" == "54.3k")
73+
#expect("\(kiloPostfixedQuantity: 123_456)" == "123.5k")
74+
#expect("\(kiloPostfixedQuantity: 654_321)" == "654.3k")
7475

75-
XCTAssertEqual("\(kiloPostfixedQuantity: 0)", "0")
76+
#expect("\(kiloPostfixedQuantity: 0)" == "0")
7677

77-
XCTAssertEqual("\(kiloPostfixedQuantity: -1)", "-1")
78-
XCTAssertEqual("\(kiloPostfixedQuantity: -999)", "-999")
79-
XCTAssertEqual("\(kiloPostfixedQuantity: -1_000)", "-1.0k")
78+
#expect("\(kiloPostfixedQuantity: -1)" == "-1")
79+
#expect("\(kiloPostfixedQuantity: -999)" == "-999")
80+
#expect("\(kiloPostfixedQuantity: -1_000)" == "-1.0k")
8081
}
8182

8283
}

0 commit comments

Comments
 (0)