|
12 | 12 | // See the License for the specific language governing permissions and |
13 | 13 | // limitations under the License. |
14 | 14 |
|
| 15 | +import Foundation |
| 16 | + |
15 | 17 | @testable import App |
16 | 18 |
|
17 | | -import XCTest |
| 19 | +import Testing |
18 | 20 |
|
19 | 21 |
|
20 | 22 | /// Tests for utilities and extesions that don't each need a full separate test class |
21 | | -class MiscTests: XCTestCase { |
| 23 | +@Suite struct MiscTests { |
22 | 24 |
|
23 | | - func test_Array_queryString() throws { |
| 25 | + @Test func Array_queryString() throws { |
24 | 26 | // Single parameter |
25 | | - XCTAssertEqual([QueryParameter(key: "foo", value: "bar")].queryString(), "?foo=bar") |
| 27 | + #expect([QueryParameter(key: "foo", value: "bar")].queryString() == "?foo=bar") |
26 | 28 |
|
27 | 29 | // Multiple parameters |
28 | | - XCTAssertEqual([ |
| 30 | + #expect([ |
29 | 31 | QueryParameter(key: "foo", value: "bar"), |
30 | 32 | QueryParameter(key: "baz", value: "erp") |
31 | | - ].queryString(), "?foo=bar&baz=erp") |
| 33 | + ].queryString() == "?foo=bar&baz=erp") |
32 | 34 |
|
33 | 35 | // Single parameter without separator |
34 | | - XCTAssertEqual([QueryParameter(key: "foo", value: "bar")].queryString(includeSeparator: false), "foo=bar") |
| 36 | + #expect([QueryParameter(key: "foo", value: "bar")].queryString(includeSeparator: false) == "foo=bar") |
35 | 37 | } |
36 | 38 |
|
37 | | - func test_Date_init_yyyyMMdd() throws { |
38 | | - XCTAssertEqual(Date("1970-01-01"), |
39 | | - Date(timeIntervalSince1970: 0)) |
40 | | - XCTAssertEqual(Date("foo"), nil) |
| 39 | + @Test func Date_init_yyyyMMdd() throws { |
| 40 | + #expect(Date("1970-01-01") == Date(timeIntervalSince1970: 0)) |
| 41 | + #expect(Date("foo") == nil) |
41 | 42 | } |
42 | 43 |
|
43 | | - func test_Date_iso8691() throws { |
44 | | - XCTAssertEqual(Date("1970-01-01T0:01:23Z"), |
45 | | - Date(timeIntervalSince1970: 83)) |
| 44 | + @Test func Date_iso8691() throws { |
| 45 | + #expect(Date("1970-01-01T0:01:23Z") == Date(timeIntervalSince1970: 83)) |
46 | 46 | } |
47 | 47 |
|
48 | | - func test_Date_LosslessStringConvertible() throws { |
49 | | - XCTAssertEqual(Date("1970-01-01"), |
50 | | - Date(timeIntervalSince1970: 0)) |
51 | | - XCTAssertEqual(Date("1970-01-01T0:01:23Z"), |
52 | | - Date(timeIntervalSince1970: 83)) |
53 | | - XCTAssertEqual(Date("foo"), nil) |
| 48 | + @Test func Date_LosslessStringConvertible() throws { |
| 49 | + #expect(Date("1970-01-01") == Date(timeIntervalSince1970: 0)) |
| 50 | + #expect(Date("1970-01-01T0:01:23Z") == Date(timeIntervalSince1970: 83)) |
| 51 | + #expect(Date("foo") == nil) |
54 | 52 | } |
55 | 53 |
|
56 | 54 | } |
0 commit comments