diff --git a/.sourcery/LinuxMain.stencil b/.sourcery/LinuxMain.stencil new file mode 100644 index 0000000..f5ff980 --- /dev/null +++ b/.sourcery/LinuxMain.stencil @@ -0,0 +1,17 @@ +@testable import AnyLintTests +@testable import Utility +import XCTest + +// swiftlint:disable line_length file_length + +{% for type in types.classes|based:"XCTestCase" %} +extension {{ type.name }} { + static var allTests: [(String, ({{ type.name }}) -> () throws -> Void)] = [ + {% for method in type.methods where method.parameters.count == 0 and method.shortName|hasPrefix:"test" and method|!annotated:"skipTestOnLinux" %} ("{{ method.shortName }}", {{ method.shortName }}){% if not forloop.last %},{% endif %} + {% endfor %}] +} + +{% endfor %} +XCTMain([ +{% for type in types.classes|based:"XCTestCase" %} testCase({{ type.name }}.allTests){% if not forloop.last %},{% endif %} +{% endfor %}]) diff --git a/README.md b/README.md index 8ad601f..1849840 100644 --- a/README.md +++ b/README.md @@ -374,6 +374,12 @@ Thank you very much for any donation, it really helps out a lot! 💯 Contributions are welcome. Feel free to open an issue on GitHub with your ideas or implement an idea yourself and post a pull request. If you want to contribute code, please try to follow the same syntax and semantic in your **commit messages** (see rationale [here](http://chris.beams.io/posts/git-commit/)). Also, please make sure to add an entry to the `CHANGELOG.md` file which explains your change. +To update the Linux tests, run [Sourcery](https://github.com/krzysztofzablocki/Sourcery) like this: + +```bash +sourcery --sources Tests --templates .sourcery/LinuxMain.stencil --output .sourcery --force-parse generated && mv .sourcery/LinuxMain.generated.swift Tests/LinuxMain.swift +``` + ## License This library is released under the [MIT License](http://opensource.org/licenses/MIT). See LICENSE for details. diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift new file mode 100644 index 0000000..d53e744 --- /dev/null +++ b/Tests/LinuxMain.swift @@ -0,0 +1,94 @@ +// Generated using Sourcery 0.17.0 — https://github.com/krzysztofzablocki/Sourcery +// DO NOT EDIT + +@testable import AnyLintTests +@testable import Utility +import XCTest + +// swiftlint:disable line_length file_length + +extension AnyLintCLITests { + static var allTests: [(String, (AnyLintCLITests) -> () throws -> Void)] = [ + ("testExample", testExample) + ] +} + +extension AutoCorrectionTests { + static var allTests: [(String, (AutoCorrectionTests) -> () throws -> Void)] = [ + ("testInitWithDictionaryLiteral", testInitWithDictionaryLiteral) + ] +} + +extension CheckInfoTests { + static var allTests: [(String, (CheckInfoTests) -> () throws -> Void)] = [ + ("testInitWithStringLiteral", testInitWithStringLiteral) + ] +} + +extension FileContentsCheckerTests { + static var allTests: [(String, (FileContentsCheckerTests) -> () throws -> Void)] = [ + ("testPerformCheck", testPerformCheck) + ] +} + +extension FilePathsCheckerTests { + static var allTests: [(String, (FilePathsCheckerTests) -> () throws -> Void)] = [ + ("testPerformCheck", testPerformCheck) + ] +} + +extension FilesSearchTests { + static var allTests: [(String, (FilesSearchTests) -> () throws -> Void)] = [ + ("testAllFilesWithinPath", testAllFilesWithinPath) + ] +} + +extension LintTests { + static var allTests: [(String, (LintTests) -> () throws -> Void)] = [ + ("testValidateRegexMatchesForEach", testValidateRegexMatchesForEach), + ("testValidateRegexDoesNotMatchAny", testValidateRegexDoesNotMatchAny), + ("testValidateAutocorrectsAllExamplesWithAnonymousGroups", testValidateAutocorrectsAllExamplesWithAnonymousGroups), + ("testValidateAutocorrectsAllExamplesWithNamedGroups", testValidateAutocorrectsAllExamplesWithNamedGroups) + ] +} + +extension LoggerTests { + static var allTests: [(String, (LoggerTests) -> () throws -> Void)] = [ + ("testMessage", testMessage) + ] +} + +extension RegexExtTests { + static var allTests: [(String, (RegexExtTests) -> () throws -> Void)] = [ + ("testInitWithStringLiteral", testInitWithStringLiteral), + ("testInitWithDictionaryLiteral", testInitWithDictionaryLiteral), + ("testStringLiteralInit", testStringLiteralInit) + ] +} + +extension StatisticsTests { + static var allTests: [(String, (StatisticsTests) -> () throws -> Void)] = [ + ("testFoundViolationsInCheck", testFoundViolationsInCheck), + ("testLogSummary", testLogSummary) + ] +} + +extension ViolationTests { + static var allTests: [(String, (ViolationTests) -> () throws -> Void)] = [ + ("testLocationMessage", testLocationMessage) + ] +} + +XCTMain([ + testCase(AnyLintCLITests.allTests), + testCase(AutoCorrectionTests.allTests), + testCase(CheckInfoTests.allTests), + testCase(FileContentsCheckerTests.allTests), + testCase(FilePathsCheckerTests.allTests), + testCase(FilesSearchTests.allTests), + testCase(LintTests.allTests), + testCase(LoggerTests.allTests), + testCase(RegexExtTests.allTests), + testCase(StatisticsTests.allTests), + testCase(ViolationTests.allTests) +])