Skip to content

Commit

Permalink
Update the project to Swift 5.4 (#125)
Browse files Browse the repository at this point in the history
* Update the project to Swift 5.4

- Splash now uses the Swift 5.4 toolchain.
- Since Swift 5.4 now enables automatic test discovery on all supported
   platforms, all of the infrastructure that was previously used to maintain
   Linux unit testing compatibility has now been removed.

* Remove LinuxMain.swift
  • Loading branch information
JohnSundell authored Jun 14, 2021
1 parent 4df8c3e commit 7f87f19
Show file tree
Hide file tree
Showing 20 changed files with 9 additions and 431 deletions.
10 changes: 5 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.2
// swift-tools-version:5.4

/**
* Splash
Expand All @@ -19,19 +19,19 @@ let package = Package(
],
targets: [
.target(name: "Splash"),
.target(
.executableTarget(
name: "SplashMarkdown",
dependencies: ["Splash"]
),
.target(
.executableTarget(
name: "SplashHTMLGen",
dependencies: ["Splash"]
),
.target(
.executableTarget(
name: "SplashImageGen",
dependencies: ["Splash"]
),
.target(
.executableTarget(
name: "SplashTokenizer",
dependencies: ["Splash"]
),
Expand Down
12 changes: 0 additions & 12 deletions Tests/LinuxMain.swift

This file was deleted.

28 changes: 0 additions & 28 deletions Tests/SplashTests/Core/SplashTestCase.swift

This file was deleted.

2 changes: 1 addition & 1 deletion Tests/SplashTests/Core/SyntaxHighlighterTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Splash

/// Test case used as an abstract base class for all tests relating to
/// syntax highlighting. For all such tests, the Swift grammar is used.
class SyntaxHighlighterTestCase: SplashTestCase {
class SyntaxHighlighterTestCase: XCTestCase {
private(set) var highlighter: SyntaxHighlighter<OutputFormatMock>!
private(set) var builder: OutputBuilderMock!

Expand Down
37 changes: 0 additions & 37 deletions Tests/SplashTests/Core/TestCaseVerifier.swift

This file was deleted.

10 changes: 0 additions & 10 deletions Tests/SplashTests/Core/TestClosure.swift

This file was deleted.

21 changes: 0 additions & 21 deletions Tests/SplashTests/Core/XCTestCase+TestNames.swift

This file was deleted.

26 changes: 0 additions & 26 deletions Tests/SplashTests/Core/XCTestManifests.swift

This file was deleted.

24 changes: 0 additions & 24 deletions Tests/SplashTests/Tests/ClosureTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -259,28 +259,4 @@ final class ClosureTests: SyntaxHighlighterTestCase {
.plainText("}")
])
}

func testAllTestsRunOnLinux() {
XCTAssertTrue(TestCaseVerifier.verifyLinuxTests((type(of: self)).allTests))
}
}

extension ClosureTests {
static var allTests: [(String, TestClosure<ClosureTests>)] {
return [
("testTrailingClosureWithArguments", testTrailingClosureWithArguments),
("testTrailingClosureWithoutParanthesis", testTrailingClosureWithoutParanthesis),
("testEmptyTrailingClosure", testEmptyTrailingClosure),
("testClosureArgumentWithSingleArgument", testClosureArgumentWithSingleArgument),
("testClosureArgumentWithMultipleArguments", testClosureArgumentWithMultipleArguments),
("testEscapingClosureArgument", testEscapingClosureArgument),
("testClosureWithInoutArgument", testClosureWithInoutArgument),
("testPassingClosureAsArgument", testPassingClosureAsArgument),
("testNestedEscapingClosure", testNestedEscapingClosure),
("testClosureArgumentShorthands", testClosureArgumentShorthands),
("testClosureWithWeakSelfCaptureList", testClosureWithWeakSelfCaptureList),
("testClosureWithUnownedSelfCaptureList", testClosureWithUnownedSelfCaptureList),
("testClosureWithSingleFunctionCall", testClosureWithSingleFunctionCall)
]
}
}
27 changes: 0 additions & 27 deletions Tests/SplashTests/Tests/CommentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -358,31 +358,4 @@ final class CommentTests: SyntaxHighlighterTestCase {
.plainText("}")
])
}

func testAllTestsRunOnLinux() {
XCTAssertTrue(TestCaseVerifier.verifyLinuxTests((type(of: self)).allTests))
}
}

extension CommentTests {
static var allTests: [(String, TestClosure<CommentTests>)] {
return [
("testSingleLineComment", testSingleLineComment),
("testMultiLineComment", testMultiLineComment),
("testMultiLineCommentWithDoubleAsterisks", testMultiLineCommentWithDoubleAsterisks),
("testMutliLineDocumentationComment", testMutliLineDocumentationComment),
("testCommentStartingWithPunctuation", testCommentStartingWithPunctuation),
("testCommentEndingWithComma", testCommentEndingWithComma),
("testCommentPrecededByComma", testCommentPrecededByComma),
("testCommentWithNumber", testCommentWithNumber),
("testCommentWithNoWhiteSpaceToPunctuation", testCommentWithNoWhiteSpaceToPunctuation),
("testCommentsNextToCurlyBrackets", testCommentsNextToCurlyBrackets),
("testCommentWithinGenericTypeList", testCommentWithinGenericTypeList),
("testCommentsNextToGenericTypeList", testCommentsNextToGenericTypeList),
("testCommentsNextToInitialization", testCommentsNextToInitialization),
("testCommentsNextToProtocolName", testCommentsNextToProtocolName),
("testCommentsAfterOptionalTypes", testCommentsAfterOptionalTypes),
("testCommentsAfterArrayTypes", testCommentsAfterArrayTypes)
]
}
}
63 changes: 0 additions & 63 deletions Tests/SplashTests/Tests/DeclarationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1326,67 +1326,4 @@ final class DeclarationTests: SyntaxHighlighterTestCase {
.plainText("}")
])
}

func testAllTestsRunOnLinux() {
XCTAssertTrue(TestCaseVerifier.verifyLinuxTests((type(of: self)).allTests))
}
}

extension DeclarationTests {
static var allTests: [(String, TestClosure<DeclarationTests>)] {
return [
("testFunctionDeclaration", testFunctionDeclaration),
("testRequiredFunctionDeclaration", testRequiredFunctionDeclaration),
("testPublicFunctionDeclarationWithDocumentationEndingWithDot", testPublicFunctionDeclarationWithDocumentationEndingWithDot),
("testFunctionDeclarationWithEmptyExternalLabel", testFunctionDeclarationWithEmptyExternalLabel),
("testFunctionDeclarationWithKeywordArgumentLabel", testFunctionDeclarationWithKeywordArgumentLabel),
("testFunctionDeclarationWithKeywordArgumentLabelOnNewLine", testFunctionDeclarationWithKeywordArgumentLabelOnNewLine),
("testGenericFunctionDeclarationWithKeywordArgumentLabel", testGenericFunctionDeclarationWithKeywordArgumentLabel),
("testGenericFunctionDeclarationWithoutConstraints", testGenericFunctionDeclarationWithoutConstraints),
("testGenericFunctionDeclarationWithSingleConstraint", testGenericFunctionDeclarationWithSingleConstraint),
("testGenericFunctionDeclarationWithMultipleConstraints", testGenericFunctionDeclarationWithMultipleConstraints),
("testGenericFunctionDeclarationWithGenericParameter", testGenericFunctionDeclarationWithGenericParameter),
("testFunctionDeclarationWithGenericReturnType", testFunctionDeclarationWithGenericReturnType),
("testGenericStructDeclaration", testGenericStructDeclaration),
("testClassDeclaration", testClassDeclaration),
("testCompactClassDeclarationWithInitializer", testCompactClassDeclarationWithInitializer),
("testClassDeclarationWithDeinit", testClassDeclarationWithDeinit),
("testClassDeclarationWithMultipleProtocolConformances", testClassDeclarationWithMultipleProtocolConformances),
("testSubclassDeclaration", testSubclassDeclaration),
("testGenericSubclassDeclaration", testGenericSubclassDeclaration),
("testProtocolDeclaration", testProtocolDeclaration),
("testProtocolDeclarationWithAssociatedTypes", testProtocolDeclarationWithAssociatedTypes),
("testExtensionDeclaration", testExtensionDeclaration),
("testExtensionDeclarationWithConvenienceInitializer", testExtensionDeclarationWithConvenienceInitializer),
("testExtensionDeclarationWithConstraint", testExtensionDeclarationWithConstraint),
("testLazyPropertyDeclaration", testLazyPropertyDeclaration),
("testDynamicPropertyDeclaration", testDynamicPropertyDeclaration),
("testGenericPropertyDeclaration", testGenericPropertyDeclaration),
("testPropertyDeclarationWithWillSet", testPropertyDeclarationWithWillSet),
("testPropertyDeclarationWithDidSet", testPropertyDeclarationWithDidSet),
("testPropertyWithCommentedDidSet", testPropertyWithCommentedDidSet),
("testPropertyWithSetterAccessLevel", testPropertyWithSetterAccessLevel),
("testPropertyDeclarationAfterCommentEndingWithVarKeyword", testPropertyDeclarationAfterCommentEndingWithVarKeyword),
("testPropertyDeclarationWithStaticPropertyDefaultValue", testPropertyDeclarationWithStaticPropertyDefaultValue),
("testSubscriptDeclaration", testSubscriptDeclaration),
("testGenericSubscriptDeclaration", testGenericSubscriptDeclaration),
("testDeferDeclaration", testDeferDeclaration),
("testFunctionDeclarationWithInOutParameter", testFunctionDeclarationWithInOutParameter),
("testFunctionDeclarationWithIgnoredParameter", testFunctionDeclarationWithIgnoredParameter),
("testFunctionDeclarationWithNonEscapedKeywordAsName", testFunctionDeclarationWithNonEscapedKeywordAsName),
("testFunctionDeclarationWithEscapedKeywordAsName", testFunctionDeclarationWithEscapedKeywordAsName),
("testFunctionDeclarationWithPreProcessors", testFunctionDeclarationWithPreProcessors),
("testNonMutatingFunction", testNonMutatingFunction),
("testRethrowingFunctionDeclaration", testRethrowingFunctionDeclaration),
("testFunctionDeclarationWithOpaqueReturnType", testFunctionDeclarationWithOpaqueReturnType),
("testPrefixFunctionDeclaration", testPrefixFunctionDeclaration),
("testEnumDeclarationWithSomeCase", testEnumDeclarationWithSomeCase),
("testIndirectEnumDeclaration", testIndirectEnumDeclaration),
("testPropertyWrapperDeclaration", testPropertyWrapperDeclaration),
("testWrappedPropertyDeclarations", testWrappedPropertyDeclarations),
("testWrappedPropertyDeclarationUsingNestedType", testWrappedPropertyDeclarationUsingNestedType),
("testWrappedPropertyDeclarationUsingExplicitType", testWrappedPropertyDeclarationUsingExplicitType),
("testGenericInitializerDeclaration", testGenericInitializerDeclaration)
]
}
}
15 changes: 0 additions & 15 deletions Tests/SplashTests/Tests/EnumTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,4 @@ final class EnumTests: SyntaxHighlighterTestCase {
.plainText("]")
])
}

func testAllTestsRunOnLinux() {
XCTAssertTrue(TestCaseVerifier.verifyLinuxTests((type(of: self)).allTests))
}
}

extension EnumTests {
static var allTests: [(String, TestClosure<EnumTests>)] {
return [
("testEnumDotSyntaxInAssignment", testEnumDotSyntaxInAssignment),
("testEnumDotSyntaxAsArgument", testEnumDotSyntaxAsArgument),
("testEnumDotSyntaxWithAssociatedValueTreatedAsCall", testEnumDotSyntaxWithAssociatedValueTreatedAsCall),
("testUsingEnumInSubscript", testUsingEnumInSubscript)
]
}
}
28 changes: 0 additions & 28 deletions Tests/SplashTests/Tests/FunctionCallTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -249,32 +249,4 @@ final class FunctionCallTests: SyntaxHighlighterTestCase {
.plainText("}")
])
}

func testAllTestsRunOnLinux() {
XCTAssertTrue(TestCaseVerifier.verifyLinuxTests((type(of: self)).allTests))
}
}

extension FunctionCallTests {
static var allTests: [(String, TestClosure<FunctionCallTests>)] {
return [
("testFunctionCallWithIntegers", testFunctionCallWithIntegers),
("testFunctionCallWithNil", testFunctionCallWithNil),
("testImplicitInitializerCall", testImplicitInitializerCall),
("testExplicitInitializerCall", testExplicitInitializerCall),
("testExplicitInitializerCallUsingTrailingClosureSyntax", testExplicitInitializerCallUsingTrailingClosureSyntax),
("testDotSyntaxInitializerCall", testDotSyntaxInitializerCall),
("testAccessingPropertyAfterFunctionCallWithoutArguments", testAccessingPropertyAfterFunctionCallWithoutArguments),
("testAccessingPropertyAfterFunctionCallWithArguments", testAccessingPropertyAfterFunctionCallWithArguments),
("testCallingStaticMethodOnGenericType", testCallingStaticMethodOnGenericType),
("testPassingTypeToFunction", testPassingTypeToFunction),
("testPassingBoolToUnnamedArgument", testPassingBoolToUnnamedArgument),
("testIndentedFunctionCalls", testIndentedFunctionCalls),
("testXCTAssertCalls", testXCTAssertCalls),
("testUsingTryKeywordWithinFunctionCall", testUsingTryKeywordWithinFunctionCall),
("testCallingFunctionsWithProjectedPropertyWrapperValues", testCallingFunctionsWithProjectedPropertyWrapperValues),
("testCallingFunctionWithInoutProjectedPropertyWrapperValue", testCallingFunctionWithInoutProjectedPropertyWrapperValue),
("testCallingMethodWithSameNameAsKeywordWithTrailingClosureSyntax", testCallingMethodWithSameNameAsKeywordWithTrailingClosureSyntax)
]
}
}
16 changes: 1 addition & 15 deletions Tests/SplashTests/Tests/HTMLOutputFormatTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation
import XCTest
import Splash

final class HTMLOutputFormatTests: SplashTestCase {
final class HTMLOutputFormatTests: XCTestCase {
private var highlighter: SyntaxHighlighter<HTMLOutputFormat>!

override func setUp() {
Expand Down Expand Up @@ -39,18 +39,4 @@ final class HTMLOutputFormatTests: SplashTestCase {
<span class="comment">// Hey I'm a comment!</span>
""")
}

func testAllTestsRunOnLinux() {
XCTAssertTrue(TestCaseVerifier.verifyLinuxTests((type(of: self)).allTests))
}
}

extension HTMLOutputFormatTests {
static var allTests: [(String, TestClosure<HTMLOutputFormatTests>)] {
return [
("testBasicGeneration", testBasicGeneration),
("testStrippingGreaterAndLessThanCharactersFromOutput", testStrippingGreaterAndLessThanCharactersFromOutput),
("testCommentMerging", testCommentMerging)
]
}
}
Loading

0 comments on commit 7f87f19

Please sign in to comment.