File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed
Tests/Functional/ListTests Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,8 @@ $ ./FooTests Tests.FooTestCase # Run all the tests in FooTestCase
44
44
45
45
``` sh
46
46
$ ./FooTests --list-tests
47
+ Listing 4 tests in FooTests.xctest:
48
+
47
49
Tests.FooTestCase/testFoo
48
50
Tests.FooTestCase/testBar
49
51
Tests.BarTestCase/test123
Original file line number Diff line number Diff line change @@ -27,6 +27,11 @@ internal struct TestListing {
27
27
/// Prints a flat list of the tests in the suite, in the format used to
28
28
/// specify a test by name when running tests.
29
29
func printTestList( ) {
30
+ let list = testSuite. list ( )
31
+ let tests = list. count == 1 ? " test " : " tests "
32
+ let bundleName = testSuite. findBundleTestSuite ( ) ? . name ?? " <<unknown bundle>> "
33
+
34
+ print ( " Listing \( list. count) \( tests) in \( bundleName) : \n " )
30
35
for entry in testSuite. list ( ) {
31
36
print ( entry)
32
37
}
@@ -76,6 +81,14 @@ extension XCTestSuite: Listable {
76
81
" tests " : listedTests. bridge ( )
77
82
] . bridge ( )
78
83
}
84
+
85
+ func findBundleTestSuite( ) -> XCTestSuite ? {
86
+ if name. hasSuffix ( " .xctest " ) {
87
+ return self
88
+ } else {
89
+ return tests. flatMap ( { ( $0 as? XCTestSuite ) ? . findBundleTestSuite ( ) } ) . first
90
+ }
91
+ }
79
92
}
80
93
81
94
extension XCTestCase : Listable {
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ if Process.arguments.contains("--verify") {
32
32
exit ( 0 )
33
33
}
34
34
35
+ // CHECK: Listing 4 tests in .*\.xctest:
36
+ // CHECK: ^$
35
37
36
38
class FirstTestCase : XCTestCase {
37
39
static var allTests = {
You can’t perform that action at this time.
0 commit comments