Skip to content

Commit

Permalink
Run tests on Xcode 12 as well
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelofabri committed Aug 4, 2020
1 parent 0dd3dac commit 1f5ee4d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
6 changes: 3 additions & 3 deletions Tests/SwiftLintFrameworkTests/IndentationWidthRuleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
)
}
Expand Down
10 changes: 5 additions & 5 deletions Tests/SwiftLintFrameworkTests/LinterCacheTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion Tests/SwiftLintFrameworkTests/SwiftVersionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 7 additions & 7 deletions Tests/SwiftLintFrameworkTests/TestHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
)
}

Expand All @@ -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)
}
}

Expand Down Expand Up @@ -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)
}
}
}
4 changes: 4 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1f5ee4d

Please sign in to comment.