Skip to content

Commit 7e58a61

Browse files
committed
Side effect should be placed in compareJSONString rather than versionedExpectedFilename.
1 parent c51a12a commit 7e58a61

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Tests/SourceKittenFrameworkTests/SwiftDocsTests.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ func compareJSONString(withFixtureNamed name: String,
3131
withTemplate: "\"key\\.filepath\" : \"\",")
3232
#endif
3333

34-
let expectedFile = File(path: versionedExpectedFilename(for: name))!
34+
let versionedFilename = versionedExpectedFilename(for: name)
35+
print("Loading \(versionedFilename)")
36+
let expectedFile = File(path: versionedFilename)!
3537

3638
if overwrite && actualContent != expectedFile.contents {
3739
_ = try? actualContent.data(using: .utf8)?.write(to: URL(fileURLWithPath: expectedFile.path!), options: [])
@@ -78,14 +80,11 @@ private func versionedExpectedFilename(for name: String) -> String {
7880
for platform in platforms {
7981
let versionedFilename = "\(fixturesDirectory)\(platform)\(name)@\(version).json"
8082
if FileManager.default.fileExists(atPath: versionedFilename) {
81-
print("Loading \(versionedFilename)")
8283
return versionedFilename
8384
}
8485
}
8586
}
86-
let fallbackFilename = "\(fixturesDirectory)\(name).json"
87-
print("Loading \(fallbackFilename)")
88-
return fallbackFilename
87+
return "\(fixturesDirectory)\(name).json"
8988
}
9089

9190
class SwiftDocsTests: XCTestCase {

0 commit comments

Comments
 (0)