From 1f5ee4d9fd07fff7b05a794e530c1e04ddb7de6d Mon Sep 17 00:00:00 2001 From: Marcelo Fabri Date: Tue, 4 Aug 2020 02:45:42 -0700 Subject: [PATCH] Run tests on Xcode 12 as well --- .../IndentationWidthRuleTests.swift | 6 +++--- .../SwiftLintFrameworkTests/LinterCacheTests.swift | 10 +++++----- .../SwiftVersionTests.swift | 4 +++- Tests/SwiftLintFrameworkTests/TestHelpers.swift | 14 +++++++------- azure-pipelines.yml | 4 ++++ 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Tests/SwiftLintFrameworkTests/IndentationWidthRuleTests.swift b/Tests/SwiftLintFrameworkTests/IndentationWidthRuleTests.swift index ef534d966..401fd2b1a 100644 --- a/Tests/SwiftLintFrameworkTests/IndentationWidthRuleTests.swift +++ b/Tests/SwiftLintFrameworkTests/IndentationWidthRuleTests.swift @@ -175,7 +175,7 @@ class IndentationWidthRuleTests: XCTestCase { if let includeComments = includeComments { configDict["include_comments"] = includeComments } guard let config = makeConfig(configDict, IndentationWidthRule.description.identifier) else { - XCTFail("Unable to create rule configuration.", file: file, line: line) + XCTFail("Unable to create rule configuration.", file: (file), line: line) return 0 } @@ -192,14 +192,14 @@ class IndentationWidthRuleTests: XCTestCase { ) { XCTAssertEqual( countViolations( - in: Example(string, file: file, line: line), + in: Example(string, file: (file), line: line), indentationWidth: indentationWidth, includeComments: includeComments, file: file, line: line ), expectedCount, - file: file, + file: (file), line: line ) } diff --git a/Tests/SwiftLintFrameworkTests/LinterCacheTests.swift b/Tests/SwiftLintFrameworkTests/LinterCacheTests.swift index eaf7e8fde..ac4c97c2a 100644 --- a/Tests/SwiftLintFrameworkTests/LinterCacheTests.swift +++ b/Tests/SwiftLintFrameworkTests/LinterCacheTests.swift @@ -78,7 +78,7 @@ class LinterCacheTests: XCTestCase { cache.cache(violations: violations, forFile: forFile, configuration: configuration) cache = cache.flushed() XCTAssertEqual(cache.violations(forFile: forFile, configuration: configuration)!, - violations, file: file, line: line) + violations, file: (file), line: line) } private func cacheAndValidateNoViolationsTwoFiles(configuration: Configuration, @@ -97,11 +97,11 @@ class LinterCacheTests: XCTestCase { let newConfig = Configuration(dict: dict)! let (file1, file2) = ("file1.swift", "file2.swift") - XCTAssertNil(cache.violations(forFile: file1, configuration: newConfig), file: file, line: line) - XCTAssertNil(cache.violations(forFile: file2, configuration: newConfig), file: file, line: line) + XCTAssertNil(cache.violations(forFile: file1, configuration: newConfig), file: (file), line: line) + XCTAssertNil(cache.violations(forFile: file2, configuration: newConfig), file: (file), line: line) - XCTAssertEqual(cache.violations(forFile: file1, configuration: initialConfig)!, [], file: file, line: line) - XCTAssertEqual(cache.violations(forFile: file2, configuration: initialConfig)!, [], file: file, line: line) + XCTAssertEqual(cache.violations(forFile: file1, configuration: initialConfig)!, [], file: (file), line: line) + XCTAssertEqual(cache.violations(forFile: file2, configuration: initialConfig)!, [], file: (file), line: line) } // MARK: Cache Reuse diff --git a/Tests/SwiftLintFrameworkTests/SwiftVersionTests.swift b/Tests/SwiftLintFrameworkTests/SwiftVersionTests.swift index 13c90d00c..22f16f2bf 100644 --- a/Tests/SwiftLintFrameworkTests/SwiftVersionTests.swift +++ b/Tests/SwiftLintFrameworkTests/SwiftVersionTests.swift @@ -4,7 +4,9 @@ import XCTest final class SwiftVersionTests: XCTestCase { // swiftlint:disable:next function_body_length func testDetectSwiftVersion() { - #if compiler(>=5.2.4) + #if compiler(>=5.3.0) + let version = "5.3.0" + #elseif compiler(>=5.2.4) let version = "5.2.4" #elseif compiler(>=5.2.3) let version = "5.2.3" diff --git a/Tests/SwiftLintFrameworkTests/TestHelpers.swift b/Tests/SwiftLintFrameworkTests/TestHelpers.swift index 5b5754195..cb24db388 100644 --- a/Tests/SwiftLintFrameworkTests/TestHelpers.swift +++ b/Tests/SwiftLintFrameworkTests/TestHelpers.swift @@ -285,7 +285,7 @@ extension XCTestCase { ruleConfiguration, ruleDescription.identifier, skipDisableCommandTests: skipDisableCommandTests) else { - XCTFail("Failed to create configuration", file: file, line: line) + XCTFail("Failed to create configuration", file: (file), line: line) return } @@ -342,7 +342,7 @@ extension XCTestCase { XCTAssertEqual( triggers.flatMap({ makeViolations($0.with(code: "/*\n " + $0.code + "\n */")) }).count, commentDoesntViolate ? 0 : triggers.count, - file: file, line: line + file: (file), line: line ) } @@ -351,14 +351,14 @@ extension XCTestCase { XCTAssertEqual( triggers.flatMap({ makeViolations($0.with(code: $0.code.toStringLiteral())) }).count, stringDoesntViolate ? 0 : triggers.count, - file: file, line: line + file: (file), line: line ) } // "disable" commands doesn't violate for command in disableCommands { XCTAssert(triggers.flatMap({ makeViolations($0.with(code: command + $0.code)) }).isEmpty, - file: file, line: line) + file: (file), line: line) } } @@ -460,13 +460,13 @@ extension XCTestCase { closure: () throws -> Void) { do { try closure() - XCTFail("No error caught", file: file, line: line) + XCTFail("No error caught", file: (file), line: line) } catch let rError as T { if error != rError { - XCTFail("Wrong error caught. Got \(rError) but was expecting \(error)", file: file, line: line) + XCTFail("Wrong error caught. Got \(rError) but was expecting \(error)", file: (file), line: line) } } catch { - XCTFail("Wrong error caught", file: file, line: line) + XCTFail("Wrong error caught", file: (file), line: line) } } } diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 03502be81..dce49b7f8 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -33,6 +33,8 @@ jobs: DEVELOPER_DIR: /Applications/Xcode_11.3.1.app xcode114: DEVELOPER_DIR: /Applications/Xcode_11.4.app + xcode12: + DEVELOPER_DIR: /Applications/Xcode_12_beta.app steps: - script: git submodule update --init --recursive displayName: Update git submodules @@ -67,6 +69,8 @@ jobs: DEVELOPER_DIR: /Applications/Xcode_11.3.1.app xcode114: DEVELOPER_DIR: /Applications/Xcode_11.4.app + xcode12: + DEVELOPER_DIR: /Applications/Xcode_12_beta.app steps: - script: | sw_vers