Skip to content

Commit

Permalink
Revert "don't reuse same instance of TestFileManager across tests"
Browse files Browse the repository at this point in the history
This reverts commit c1118aa.
  • Loading branch information
jpsim committed May 16, 2017
1 parent d836b9f commit 7918da7
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Tests/SwiftLintFrameworkTests/LinterCacheTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ import XCTest
class LinterCacheTests: XCTestCase {

private class TestFileManager: LintableFileManager {
fileprivate func filesToLint(inPath: String, rootDirectory: String? = nil) -> [String] {
func filesToLint(inPath: String, rootDirectory: String? = nil) -> [String] {
return []
}

fileprivate var stubbedModificationDateByPath: [String: Date] = [:]
internal var stubbedModificationDateByPath: [String: Date] = [:]

fileprivate func modificationDate(forFileAtPath path: String) -> Date? {
public func modificationDate(forFileAtPath path: String) -> Date? {
return stubbedModificationDateByPath[path]
}
}

private let fileManager = TestFileManager()

func testInitThrowsWhenUsingDifferentVersion() {
let cache = ["version": "0.1.0"]
checkError(LinterCacheError.differentVersion) {
Expand Down Expand Up @@ -61,7 +63,6 @@ class LinterCacheTests: XCTestCase {

func testParsesViolations() {
let cache = LinterCache(currentVersion: Version(value: "0.2.0"))
let fileManager = TestFileManager()
cache.fileManager = fileManager
let file = "foo.swift"
let ruleDescription = RuleDescription(identifier: "rule", name: "Some rule",
Expand All @@ -87,7 +88,6 @@ class LinterCacheTests: XCTestCase {

func testParsesViolationsWithEmptyViolations() {
let cache = LinterCache(currentVersion: Version(value: "0.2.0"))
let fileManager = TestFileManager()
cache.fileManager = fileManager
let file = "foo.swift"
fileManager.stubbedModificationDateByPath[file] = Date()
Expand All @@ -99,7 +99,6 @@ class LinterCacheTests: XCTestCase {

func testParsesViolationsWithNoDate() {
let cache = LinterCache(currentVersion: Version(value: "0.2.0"))
let fileManager = TestFileManager()
cache.fileManager = fileManager
let file = "foo.swift"
let ruleDescription = RuleDescription(identifier: "rule", name: "Some rule",
Expand All @@ -125,7 +124,6 @@ class LinterCacheTests: XCTestCase {

func testParsesViolationsWithDifferentDate() {
let cache = LinterCache(currentVersion: Version(value: "0.2.0"))
let fileManager = TestFileManager()
cache.fileManager = fileManager
let file = "foo.swift"
let ruleDescription = RuleDescription(identifier: "rule", name: "Some rule",
Expand Down

0 comments on commit 7918da7

Please sign in to comment.