@@ -2,75 +2,79 @@ import ComposableArchitecture
22import XCTest
33
44class TaskResultTests : XCTestCase {
5- func testEqualityNonEquatableError( ) {
6- struct Failure : Error {
7- let message : String
8- }
9-
10- XCTExpectFailure {
11- XCTAssertNotEqual (
12- TaskResult< Never> . failure( Failure ( message: " Something went wrong " ) ) ,
13- TaskResult< Never> . failure( Failure ( message: " Something went wrong " ) )
14- )
15- } issueMatcher: {
16- $0. compactDescription == """
17- 'Failure' is not equatable. …
18-
19- To test two values of this type, it must conform to the 'Equatable' protocol. For example:
205
21- extension Failure: Equatable {}
22-
23- See the documentation of 'TaskResult' for more information.
24- """
6+ // `XCTExpectFailure` is not supported on Linux
7+ #if !os(Linux)
8+ func testEqualityNonEquatableError( ) {
9+ struct Failure : Error {
10+ let message : String
11+ }
12+
13+ XCTExpectFailure {
14+ XCTAssertNotEqual (
15+ TaskResult< Never> . failure( Failure ( message: " Something went wrong " ) ) ,
16+ TaskResult< Never> . failure( Failure ( message: " Something went wrong " ) )
17+ )
18+ } issueMatcher: {
19+ $0. compactDescription == """
20+ 'Failure' is not equatable. …
21+
22+ To test two values of this type, it must conform to the 'Equatable' protocol. For example:
23+
24+ extension Failure: Equatable {}
25+
26+ See the documentation of 'TaskResult' for more information.
27+ """
28+ }
2529 }
26- }
2730
28- func testEqualityMismatchingError( ) {
29- struct Failure1 : Error {
30- let message : String
31- }
32- struct Failure2 : Error {
33- let message : String
31+ func testEqualityMismatchingError( ) {
32+ struct Failure1 : Error {
33+ let message : String
34+ }
35+ struct Failure2 : Error {
36+ let message : String
37+ }
38+
39+ XCTExpectFailure {
40+ XCTAssertNoDifference (
41+ TaskResult< Never> . failure( Failure1 ( message: " Something went wrong " ) ) ,
42+ TaskResult< Never> . failure( Failure2 ( message: " Something went wrong " ) )
43+ )
44+ } issueMatcher: {
45+ $0. compactDescription == """
46+ XCTAssertNoDifference failed: …
47+
48+ TaskResult.failure(
49+ − TaskResultTests.Failure1(message: " Something went wrong " )
50+ + TaskResultTests.Failure2(message: " Something went wrong " )
51+ )
52+
53+ (First: −, Second: +)
54+ """
55+ }
3456 }
3557
36- XCTExpectFailure {
37- XCTAssertNoDifference (
38- TaskResult< Never> . failure( Failure1 ( message: " Something went wrong " ) ) ,
39- TaskResult< Never> . failure( Failure2 ( message: " Something went wrong " ) )
40- )
41- } issueMatcher: {
42- $0. compactDescription == """
43- XCTAssertNoDifference failed: …
44-
45- TaskResult.failure(
46- − TaskResultTests.Failure1(message: " Something went wrong " )
47- + TaskResultTests.Failure2(message: " Something went wrong " )
48- )
49-
50- (First: −, Second: +)
51- """
52- }
53- }
58+ func testHashabilityNonHashableError( ) {
59+ struct Failure : Error {
60+ let message : String
61+ }
5462
55- func testHashabilityNonHashableError( ) {
56- struct Failure : Error {
57- let message : String
58- }
63+ XCTExpectFailure {
64+ _ = TaskResult < Never > . failure ( Failure ( message: " Something went wrong " ) ) . hashValue
65+ } issueMatcher: {
66+ $0. compactDescription == """
67+ 'Failure' is not hashable. …
5968
60- XCTExpectFailure {
61- _ = TaskResult < Never > . failure ( Failure ( message: " Something went wrong " ) ) . hashValue
62- } issueMatcher: {
63- $0. compactDescription == """
64- 'Failure' is not hashable. …
69+ To hash a value of this type, it must conform to the 'Hashable' protocol. For example:
6570
66- To hash a value of this type, it must conform to the ' Hashable' protocol. For example:
71+ extension Failure: Hashable {}
6772
68- extension Failure: Hashable {}
69-
70- See the documentation of 'TaskResult' for more information.
71- """
73+ See the documentation of 'TaskResult' for more information.
74+ """
75+ }
7276 }
73- }
77+ #endif
7478
7579 func testEquality_EquatableError( ) {
7680 enum Failure : Error , Equatable {
0 commit comments