|
1 | 1 | #if !os(Linux) |
2 | | -import Foundation |
3 | | -import XCTest |
4 | | -import XCTestDynamicOverlay |
| 2 | + import Foundation |
| 3 | + import XCTest |
| 4 | + import XCTestDynamicOverlay |
5 | 5 |
|
6 | | -#if canImport(FoundationNetworking) |
7 | | -import FoundationNetworking |
8 | | -#endif |
| 6 | + #if canImport(FoundationNetworking) |
| 7 | + import FoundationNetworking |
| 8 | + #endif |
9 | 9 |
|
10 | | -final class GeneratePlaceholderTests: XCTestCase { |
11 | | - func testShouldGeneratePlaceholder() async throws { |
12 | | - let bool: () -> Bool = unimplemented("bool") |
13 | | - XCTAssertEqual(XCTExpectFailure(failingBlock: bool), false) |
14 | | - let double: () -> Double = unimplemented("double") |
15 | | - XCTAssertEqual(XCTExpectFailure(failingBlock: double), 0.0) |
16 | | - let int: () -> Int = unimplemented("int") |
17 | | - XCTAssertEqual(XCTExpectFailure(failingBlock: int), 0) |
18 | | - let string: () -> String = unimplemented("string") |
19 | | - XCTAssertEqual(XCTExpectFailure(failingBlock: string), "") |
| 10 | + final class GeneratePlaceholderTests: XCTestCase { |
| 11 | + func testShouldGeneratePlaceholder() async throws { |
| 12 | + let bool: () -> Bool = unimplemented("bool") |
| 13 | + XCTAssertEqual(XCTExpectFailure(failingBlock: bool), false) |
| 14 | + let double: () -> Double = unimplemented("double") |
| 15 | + XCTAssertEqual(XCTExpectFailure(failingBlock: double), 0.0) |
| 16 | + let int: () -> Int = unimplemented("int") |
| 17 | + XCTAssertEqual(XCTExpectFailure(failingBlock: int), 0) |
| 18 | + let string: () -> String = unimplemented("string") |
| 19 | + XCTAssertEqual(XCTExpectFailure(failingBlock: string), "") |
20 | 20 |
|
21 | | - let array: () -> [Int] = unimplemented("array") |
22 | | - XCTAssertEqual(XCTExpectFailure(failingBlock: array), [Int]()) |
23 | | - let dictionary: () -> [String: Int] = unimplemented("dictionary") |
24 | | - XCTAssertEqual(XCTExpectFailure(failingBlock: dictionary), [String: Int]()) |
25 | | - let set: () -> Set<Int> = unimplemented("set") |
26 | | - XCTAssertEqual(XCTExpectFailure(failingBlock: set), Set<Int>()) |
| 21 | + let array: () -> [Int] = unimplemented("array") |
| 22 | + XCTAssertEqual(XCTExpectFailure(failingBlock: array), [Int]()) |
| 23 | + let dictionary: () -> [String: Int] = unimplemented("dictionary") |
| 24 | + XCTAssertEqual(XCTExpectFailure(failingBlock: dictionary), [String: Int]()) |
| 25 | + let set: () -> Set<Int> = unimplemented("set") |
| 26 | + XCTAssertEqual(XCTExpectFailure(failingBlock: set), Set<Int>()) |
27 | 27 |
|
28 | | - let stream: () -> AsyncStream<Int> = unimplemented("stream") |
29 | | - for await _ in XCTExpectFailure(failingBlock: stream) { |
30 | | - XCTFail("Stream should be finished") |
31 | | - } |
| 28 | + let stream: () -> AsyncStream<Int> = unimplemented("stream") |
| 29 | + for await _ in XCTExpectFailure(failingBlock: stream) { |
| 30 | + XCTFail("Stream should be finished") |
| 31 | + } |
32 | 32 |
|
33 | | - let throwingStream: () -> AsyncThrowingStream<Int, Error> = unimplemented("throwingStream") |
34 | | - let result = await Task { |
35 | | - try await XCTExpectFailure(failingBlock: throwingStream).first(where: { _ in true }) |
36 | | - }.result |
37 | | - XCTAssertThrowsError(try result.get()) { XCTAssertTrue($0 is CancellationError) } |
| 33 | + let throwingStream: () -> AsyncThrowingStream<Int, Error> = unimplemented("throwingStream") |
| 34 | + let result = await Task { |
| 35 | + try await XCTExpectFailure(failingBlock: throwingStream).first(where: { _ in true }) |
| 36 | + }.result |
| 37 | + XCTAssertThrowsError(try result.get()) { XCTAssertTrue($0 is CancellationError) } |
38 | 38 |
|
39 | | - let date: () -> Date = unimplemented("date") |
40 | | - XCTAssertNotNil(XCTExpectFailure(failingBlock: date)) |
41 | | - let url: () -> URL = unimplemented("url") |
42 | | - XCTAssertNotNil(XCTExpectFailure(failingBlock: url)) |
43 | | - let uuid: () -> UUID = unimplemented("uuid") |
44 | | - XCTAssertNotNil(XCTExpectFailure(failingBlock: uuid)) |
| 39 | + let date: () -> Date = unimplemented("date") |
| 40 | + XCTAssertNotNil(XCTExpectFailure(failingBlock: date)) |
| 41 | + let url: () -> URL = unimplemented("url") |
| 42 | + XCTAssertNotNil(XCTExpectFailure(failingBlock: url)) |
| 43 | + let uuid: () -> UUID = unimplemented("uuid") |
| 44 | + XCTAssertNotNil(XCTExpectFailure(failingBlock: uuid)) |
45 | 45 |
|
46 | | - let enumCaseIterable: () -> EnumCaseIterable = unimplemented("enumCaseIterable") |
47 | | - XCTAssertEqual(XCTExpectFailure(failingBlock: enumCaseIterable), .first) |
48 | | - let enumInt: () -> EnumInt = unimplemented("enumInt") |
49 | | - XCTAssertEqual(XCTExpectFailure(failingBlock: enumInt), .zero) |
50 | | - let taggedInt: () -> Tagged<Self, Int> = unimplemented("taggedInt") |
51 | | - XCTAssertEqual(XCTExpectFailure(failingBlock: taggedInt), 0) |
| 46 | + let enumCaseIterable: () -> EnumCaseIterable = unimplemented("enumCaseIterable") |
| 47 | + XCTAssertEqual(XCTExpectFailure(failingBlock: enumCaseIterable), .first) |
| 48 | + let enumInt: () -> EnumInt = unimplemented("enumInt") |
| 49 | + XCTAssertEqual(XCTExpectFailure(failingBlock: enumInt), .zero) |
| 50 | + let taggedInt: () -> Tagged<Self, Int> = unimplemented("taggedInt") |
| 51 | + XCTAssertEqual(XCTExpectFailure(failingBlock: taggedInt), 0) |
| 52 | + } |
52 | 53 | } |
53 | | -} |
54 | 54 |
|
55 | | -enum EnumInt: Int { case zero, one, two } |
| 55 | + enum EnumInt: Int { case zero, one, two } |
56 | 56 |
|
57 | | -enum EnumCaseIterable: CaseIterable { case first, second, third } |
| 57 | + enum EnumCaseIterable: CaseIterable { case first, second, third } |
58 | 58 |
|
59 | | -struct Tagged<Tag, RawValue: Equatable>: Equatable { var rawValue: RawValue } |
60 | | -extension Tagged: ExpressibleByIntegerLiteral where RawValue: ExpressibleByIntegerLiteral { |
61 | | - typealias IntegerLiteralType = RawValue.IntegerLiteralType |
62 | | - init(integerLiteral value: IntegerLiteralType) { |
63 | | - self.init(rawValue: RawValue(integerLiteral: value)) |
| 59 | + struct Tagged<Tag, RawValue: Equatable>: Equatable { var rawValue: RawValue } |
| 60 | + extension Tagged: ExpressibleByIntegerLiteral where RawValue: ExpressibleByIntegerLiteral { |
| 61 | + typealias IntegerLiteralType = RawValue.IntegerLiteralType |
| 62 | + init(integerLiteral value: IntegerLiteralType) { |
| 63 | + self.init(rawValue: RawValue(integerLiteral: value)) |
| 64 | + } |
64 | 65 | } |
65 | | -} |
66 | 66 | #endif |
0 commit comments