Run tests on Xcode 12 as well

This commit is contained in:
Marcelo Fabri 2020-08-04 02:45:42 -07:00
parent 0dd3dac82c
commit 1f5ee4d9fd
5 changed files with 22 additions and 16 deletions

View File

@ -175,7 +175,7 @@ class IndentationWidthRuleTests: XCTestCase {
if let includeComments = includeComments { configDict["include_comments"] = includeComments } if let includeComments = includeComments { configDict["include_comments"] = includeComments }
guard let config = makeConfig(configDict, IndentationWidthRule.description.identifier) else { 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 return 0
} }
@ -192,14 +192,14 @@ class IndentationWidthRuleTests: XCTestCase {
) { ) {
XCTAssertEqual( XCTAssertEqual(
countViolations( countViolations(
in: Example(string, file: file, line: line), in: Example(string, file: (file), line: line),
indentationWidth: indentationWidth, indentationWidth: indentationWidth,
includeComments: includeComments, includeComments: includeComments,
file: file, file: file,
line: line line: line
), ),
expectedCount, expectedCount,
file: file, file: (file),
line: line line: line
) )
} }

View File

@ -78,7 +78,7 @@ class LinterCacheTests: XCTestCase {
cache.cache(violations: violations, forFile: forFile, configuration: configuration) cache.cache(violations: violations, forFile: forFile, configuration: configuration)
cache = cache.flushed() cache = cache.flushed()
XCTAssertEqual(cache.violations(forFile: forFile, configuration: configuration)!, XCTAssertEqual(cache.violations(forFile: forFile, configuration: configuration)!,
violations, file: file, line: line) violations, file: (file), line: line)
} }
private func cacheAndValidateNoViolationsTwoFiles(configuration: Configuration, private func cacheAndValidateNoViolationsTwoFiles(configuration: Configuration,
@ -97,11 +97,11 @@ class LinterCacheTests: XCTestCase {
let newConfig = Configuration(dict: dict)! let newConfig = Configuration(dict: dict)!
let (file1, file2) = ("file1.swift", "file2.swift") let (file1, file2) = ("file1.swift", "file2.swift")
XCTAssertNil(cache.violations(forFile: file1, 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) 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: file1, configuration: initialConfig)!, [], file: (file), line: line)
XCTAssertEqual(cache.violations(forFile: file2, configuration: initialConfig)!, [], file: file, line: line) XCTAssertEqual(cache.violations(forFile: file2, configuration: initialConfig)!, [], file: (file), line: line)
} }
// MARK: Cache Reuse // MARK: Cache Reuse

View File

@ -4,7 +4,9 @@ import XCTest
final class SwiftVersionTests: XCTestCase { final class SwiftVersionTests: XCTestCase {
// swiftlint:disable:next function_body_length // swiftlint:disable:next function_body_length
func testDetectSwiftVersion() { 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" let version = "5.2.4"
#elseif compiler(>=5.2.3) #elseif compiler(>=5.2.3)
let version = "5.2.3" let version = "5.2.3"

View File

@ -285,7 +285,7 @@ extension XCTestCase {
ruleConfiguration, ruleConfiguration,
ruleDescription.identifier, ruleDescription.identifier,
skipDisableCommandTests: skipDisableCommandTests) else { skipDisableCommandTests: skipDisableCommandTests) else {
XCTFail("Failed to create configuration", file: file, line: line) XCTFail("Failed to create configuration", file: (file), line: line)
return return
} }
@ -342,7 +342,7 @@ extension XCTestCase {
XCTAssertEqual( XCTAssertEqual(
triggers.flatMap({ makeViolations($0.with(code: "/*\n " + $0.code + "\n */")) }).count, triggers.flatMap({ makeViolations($0.with(code: "/*\n " + $0.code + "\n */")) }).count,
commentDoesntViolate ? 0 : triggers.count, commentDoesntViolate ? 0 : triggers.count,
file: file, line: line file: (file), line: line
) )
} }
@ -351,14 +351,14 @@ extension XCTestCase {
XCTAssertEqual( XCTAssertEqual(
triggers.flatMap({ makeViolations($0.with(code: $0.code.toStringLiteral())) }).count, triggers.flatMap({ makeViolations($0.with(code: $0.code.toStringLiteral())) }).count,
stringDoesntViolate ? 0 : triggers.count, stringDoesntViolate ? 0 : triggers.count,
file: file, line: line file: (file), line: line
) )
} }
// "disable" commands doesn't violate // "disable" commands doesn't violate
for command in disableCommands { for command in disableCommands {
XCTAssert(triggers.flatMap({ makeViolations($0.with(code: command + $0.code)) }).isEmpty, 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) { closure: () throws -> Void) {
do { do {
try closure() try closure()
XCTFail("No error caught", file: file, line: line) XCTFail("No error caught", file: (file), line: line)
} catch let rError as T { } catch let rError as T {
if error != rError { 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 { } catch {
XCTFail("Wrong error caught", file: file, line: line) XCTFail("Wrong error caught", file: (file), line: line)
} }
} }
} }

View File

@ -33,6 +33,8 @@ jobs:
DEVELOPER_DIR: /Applications/Xcode_11.3.1.app DEVELOPER_DIR: /Applications/Xcode_11.3.1.app
xcode114: xcode114:
DEVELOPER_DIR: /Applications/Xcode_11.4.app DEVELOPER_DIR: /Applications/Xcode_11.4.app
xcode12:
DEVELOPER_DIR: /Applications/Xcode_12_beta.app
steps: steps:
- script: git submodule update --init --recursive - script: git submodule update --init --recursive
displayName: Update git submodules displayName: Update git submodules
@ -67,6 +69,8 @@ jobs:
DEVELOPER_DIR: /Applications/Xcode_11.3.1.app DEVELOPER_DIR: /Applications/Xcode_11.3.1.app
xcode114: xcode114:
DEVELOPER_DIR: /Applications/Xcode_11.4.app DEVELOPER_DIR: /Applications/Xcode_11.4.app
xcode12:
DEVELOPER_DIR: /Applications/Xcode_12_beta.app
steps: steps:
- script: | - script: |
sw_vers sw_vers