Skip to content

Commit 3e09eea

Browse files
committed
Test SwiftSyntax using --enable-test-discovery
We can thus remove the allTests properties and LinuxMain.swift
1 parent bbd78f9 commit 3e09eea

17 files changed

+2
-116
lines changed

Tests/LinuxMain.swift

Lines changed: 0 additions & 23 deletions
This file was deleted.

Tests/SwiftSyntaxTest/AbsolutePositionTests.swift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,6 @@ fileprivate class FuncRenamer: SyntaxRewriter {
1212

1313
public class AbsolutePositionTests: XCTestCase {
1414

15-
public static let allTests = [
16-
("testVisitor", testVisitor),
17-
("testClosure", testClosure),
18-
("testRename", testRename),
19-
("testCurrentFile", testCurrentFile),
20-
("testRecursion", testRecursion),
21-
("testTrivias", testTrivias),
22-
("testImplicit", testImplicit),
23-
("testWithoutSourceFileRoot", testWithoutSourceFileRoot),
24-
("testSourceLocation", testSourceLocation),
25-
]
26-
2715
public func testVisitor() {
2816
XCTAssertNoThrow(try {
2917
let source = try String(contentsOf: getInput("visitor.swift"))

Tests/SwiftSyntaxTest/ClassificationTests.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ import XCTest
22
import SwiftSyntax
33

44
public class ClassificationTests: XCTestCase {
5-
public static let allTests = [
6-
("testClassification", testClassification),
7-
("testTokenClassification", testTokenClassification),
8-
]
95

106
public func testClassification() {
117
let source = "// blah.\nlet x/*yo*/ = 0"

Tests/SwiftSyntaxTest/CustomReflecatbleTests.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ import SwiftSyntax
33

44

55
public class CustomReflectableTests: XCTestCase {
6-
public static let allTests = [
7-
("testDump", testDump),
8-
]
9-
106

117
public func testDump() {
128
struct TestCase {

Tests/SwiftSyntaxTest/DiagnosticTests.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ fileprivate extension Diagnostic.Message {
2929

3030
public class DiagnosticTests: XCTestCase {
3131

32-
public static let allTests = [
33-
("testDiagnosticEmission", testDiagnosticEmission),
34-
("testSourceLocations", testSourceLocations),
35-
]
36-
3732
public func testDiagnosticEmission() {
3833
let startLoc = loc()
3934
let fixLoc = loc()

Tests/SwiftSyntaxTest/IncrementalParsingTests.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ import SwiftSyntax
33

44
public class IncrementalParsingTests: XCTestCase {
55

6-
public static let allTests = [
7-
("testIncrementalInvalid", testIncrementalInvalid),
8-
("testReusedNode", testReusedNode),
9-
]
10-
116
public func testIncrementalInvalid() {
127
let original = "struct A { func f() {"
138
let step: (String, (Int, Int, String)) =

Tests/SwiftSyntaxTest/MultithreadingTests.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ import SwiftSyntax
33

44
public class MultithreadingTests: XCTestCase {
55

6-
public static let allTests = [
7-
("testPathological", testPathological),
8-
("testTwoAccesses", testTwoAccesses),
9-
]
10-
116
public func testPathological() {
127
let tuple = SyntaxFactory.makeVoidTupleType()
138

Tests/SwiftSyntaxTest/ParseFileTests.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ enum Animal {
2525

2626
public class ParseFileTests: XCTestCase {
2727

28-
public static let allTests = [
29-
("testParseSingleFile", testParseSingleFile),
30-
("testEnumCaseStructure", testEnumCaseStructure)
31-
]
32-
3328
public func testParseSingleFile() {
3429
let currentFile = URL(fileURLWithPath: #file)
3530
XCTAssertNoThrow(try {

Tests/SwiftSyntaxTest/SyntaxChildrenTests.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ import SwiftSyntax
33

44
public class SyntaxChildrenTests: XCTestCase {
55

6-
public static let allTests = [
7-
("testIterateWithAllPresent", testIterateWithAllPresent),
8-
("testIterateWithSomeMissing", testIterateWithSomeMissing),
9-
("testIterateWithAllMissing", testIterateWithAllMissing),
10-
]
11-
126
public func testIterateWithAllPresent() {
137
let returnStmt = SyntaxFactory.makeReturnStmt(
148
returnKeyword: SyntaxFactory.makeReturnKeyword(),

Tests/SwiftSyntaxTest/SyntaxCollectionsTests.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,6 @@ fileprivate func integerLiteralElement(_ int: Int) -> ArrayElementSyntax {
1010

1111
public class SyntaxCollectionsTests: XCTestCase {
1212

13-
public static let allTests = [
14-
("testAppendingElement", testAppendingElement),
15-
("testInsertingElement", testInsertingElement),
16-
("testPrependingElement", testPrependingElement),
17-
("testRemovingFirstElement", testRemovingFirstElement),
18-
("testRemovingLastElement", testRemovingLastElement),
19-
("testRemovingElement", testRemovingElement),
20-
("testReplacingElement", testReplacingElement),
21-
("testIteration", testIteration),
22-
]
23-
2413
public func testAppendingElement() {
2514
let arrayElementList = SyntaxFactory.makeArrayElementList([
2615
integerLiteralElement(0)

Tests/SwiftSyntaxTest/SyntaxFactoryTests.swift

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,6 @@ fileprivate func cannedStructDecl() -> StructDeclSyntax {
1818

1919
public class SyntaxFactoryTests: XCTestCase {
2020

21-
public static let allTests = [
22-
("testGenerated", testGenerated),
23-
("testTokenSyntax", testTokenSyntax),
24-
("testFunctionCallSyntaxBuilder", testFunctionCallSyntaxBuilder),
25-
("testWithOptionalChild", testWithOptionalChild),
26-
("testUnknownSyntax", testUnknownSyntax),
27-
("testMakeStringLiteralExpr", testMakeStringLiteralExpr),
28-
("testMakeBinaryOperator", testMakeBinaryOperator),
29-
]
30-
3121
public func testGenerated() {
3222

3323
let structDecl = cannedStructDecl()

Tests/SwiftSyntaxTest/SyntaxTests.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ import SwiftSyntax
33

44
public class SyntaxTests: XCTestCase {
55

6-
public static let allTests = [
7-
("testSyntaxAPI", testSyntaxAPI),
8-
("testPositions", testPositions),
9-
]
10-
116
public func testSyntaxAPI() {
127
let source = "struct A { func f() {} }"
138
let tree = try! SyntaxParser.parse(source: source)

Tests/SwiftSyntaxTest/SyntaxTreeModifierTests.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ fileprivate func cannedVarDecl() -> VariableDeclSyntax {
2020

2121
public class SyntaxTreeModifierTests: XCTestCase {
2222

23-
public static let allTests = [
24-
("testAccessorAsModifier", testAccessorAsModifier)
25-
]
26-
2723
public func testAccessorAsModifier() {
2824
var VD = cannedVarDecl()
2925
XCTAssertEqual("\(VD)", "let a: Int")

Tests/SwiftSyntaxTest/SyntaxVisitorTests.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@ import SwiftSyntax
33

44
public class SyntaxVisitorTests: XCTestCase {
55

6-
public static let allTests = [
7-
("testBasic", testBasic),
8-
("testRewritingNodeWithEmptyChild", testRewritingNodeWithEmptyChild),
9-
("testSyntaxRewriterVisitAny", testSyntaxRewriterVisitAny),
10-
("testSyntaxRewriterVisitCollection", testSyntaxRewriterVisitCollection),
11-
("testVisitorClass", testVisitorClass),
12-
]
13-
146
public func testBasic() {
157
class FuncCounter: SyntaxVisitor {
168
var funcCount = 0

Tests/SwiftSyntaxTest/TokenTest.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ import SwiftSyntax
33

44
public class TokenTests: XCTestCase {
55

6-
public static let allTests = [
7-
("testKeywordKinds", testKeywordKinds),
8-
]
9-
106
public func testKeywordKinds() {
117
XCTAssertTrue(TokenKind.operatorKeyword.isKeyword)
128
XCTAssertTrue(TokenKind.funcKeyword.isKeyword)

Tests/SwiftSyntaxTest/TriviaTests.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ import SwiftSyntax
33

44
public class TriviaTests: XCTestCase {
55

6-
public static let allTests = [
7-
("testTriviaEquatable", testTriviaEquatable),
8-
("testTriviaPieceEquatable", testTriviaPieceEquatable)
9-
]
10-
116
func testTriviaEquatable() {
127
XCTAssertEqual([.spaces(2), .tabs(1)] as Trivia, [.spaces(2), .tabs(1)])
138
XCTAssertNotEqual([.spaces(2), .tabs(1)] as Trivia, [.spaces(2), .tabs(2)])

build-script.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ def get_swiftpm_invocation(toolchain, action, build_dir, multiroot_data_file,
165165

166166
swiftpm_call = [swift_exec, action]
167167
swiftpm_call.extend(['--package-path', PACKAGE_DIR])
168+
if platform.system() != 'Darwin':
169+
swiftpm_call.extend(['--enable-test-discovery'])
168170
if release:
169171
swiftpm_call.extend(['--configuration', 'release'])
170172
if build_dir:

0 commit comments

Comments
 (0)