|
7 | 7 | // CHECK: In tearDown\(\)
|
8 | 8 | // CHECK: Test Case 'SetUpTearDownTestCase.test_hasValueFromSetUp' passed \(\d+\.\d+ seconds\).
|
9 | 9 | // CHECK: Executed 1 test, with 0 failures \(0 unexpected\) in \d+\.\d+ \(\d+\.\d+\) seconds
|
10 |
| -// CHECK: Total executed 1 test, with 0 failures \(0 unexpected\) in \d+\.\d+ \(\d+\.\d+\) seconds |
| 10 | +// CHECK: Test Case 'NewInstanceForEachTestTestCase.test_hasInitializedValue' started. |
| 11 | +// CHECK: Test Case 'NewInstanceForEachTestTestCase.test_hasInitializedValue' passed \(\d+\.\d+ seconds\). |
| 12 | +// CHECK: Test Case 'NewInstanceForEachTestTestCase.test_hasInitializedValueInAnotherTest' started. |
| 13 | +// CHECK: Test Case 'NewInstanceForEachTestTestCase.test_hasInitializedValueInAnotherTest' passed \(\d+\.\d+ seconds\). |
| 14 | +// CHECK: Executed 2 tests, with 0 failures \(0 unexpected\) in \d+\.\d+ \(\d+\.\d+\) seconds |
| 15 | +// CHECK: Total executed 3 tests, with 0 failures \(0 unexpected\) in \d+\.\d+ \(\d+\.\d+\) seconds |
11 | 16 |
|
12 | 17 | #if os(Linux) || os(FreeBSD)
|
13 | 18 | import XCTest
|
@@ -41,4 +46,27 @@ class SetUpTearDownTestCase: XCTestCase {
|
41 | 46 | }
|
42 | 47 | }
|
43 | 48 |
|
44 |
| -XCTMain([SetUpTearDownTestCase()]) |
| 49 | +class NewInstanceForEachTestTestCase: XCTestCase { |
| 50 | + var allTests: [(String, () throws -> Void)] { |
| 51 | + return [ |
| 52 | + ("test_hasInitializedValue", test_hasInitializedValue), |
| 53 | + ("test_hasInitializedValueInAnotherTest", test_hasInitializedValueInAnotherTest), |
| 54 | + ] |
| 55 | + } |
| 56 | + |
| 57 | + var value = 1 |
| 58 | + |
| 59 | + func test_hasInitializedValue() { |
| 60 | + XCTAssertEqual(value, 1) |
| 61 | + value += 1 |
| 62 | + } |
| 63 | + |
| 64 | + func test_hasInitializedValueInAnotherTest() { |
| 65 | + XCTAssertEqual(value, 1) |
| 66 | + } |
| 67 | +} |
| 68 | + |
| 69 | +XCTMain([ |
| 70 | + SetUpTearDownTestCase(), |
| 71 | + NewInstanceForEachTestTestCase() |
| 72 | +]) |
0 commit comments