Skip to content

Commit

Permalink
. r Improve formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jonreid committed May 8, 2024
1 parent 61014f5 commit 6d47cf1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ApprovalTests.Swift/Core/Options.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public struct Options {
FileOptions(data)
}

public func getNamer(_ path: String, _ function:String) -> ApprovalNamer {
public func getNamer(_ path: String, _ function: String) -> ApprovalNamer {
let c = data[.namer] as? (String, String) -> ApprovalNamer ?? Approvals.makeNamer
return c(path, function)
}
Expand Down
4 changes: 2 additions & 2 deletions ApprovalTests.Swift/Namer/NamerFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import UIKit
#endif

public enum NamerFactory {
public static func withParameters(options: Options = Options(), _ parameters: String ...) -> Options {
public static func withParameters(options: Options = Options(), _ parameters: String...) -> Options {
return withParameters(options: options, parameters)
}

Expand All @@ -27,7 +27,7 @@ public enum NamerFactory {
withParameters(options: options, getMachineName())
}

public static func withAdditionalParameters(_ parameters: String ...) -> (Options) -> Options {
public static func withAdditionalParameters(_ parameters: String...) -> (Options) -> Options {
return { (options: Options) -> Options in
withParameters(options: options, parameters)
}
Expand Down
4 changes: 2 additions & 2 deletions ApprovalTests.Swift/Namer/ParameterizedNamer.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
class ParameterizedNamer: Namer {
private let parameters: [String]

public init(_ filePath: String, _ function: String, _ parameters: [String]) {
public init(_ filePath: String, _ function: String, _ parameters: [String]) {
self.parameters = parameters
super.init(filePath, function)
}

override func sourceFilePath() -> String {
super.sourceFilePath() + "." + parameters.joined(separator: ".")
}
Expand Down
2 changes: 1 addition & 1 deletion ApprovalTests_SwiftTests/ApprovalTests_SwiftTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class ApprovalTests_SwiftTests: XCTestCase {
}

func testSourceFilePath() throws {
let name = Approvals.makeNamer(forFile: #file, function: #function)
let name = Approvals.makeNamer(forFile: #file, function: #function)
let sourceFilePath = name.sourceFilePath()
XCTAssertTrue(
sourceFilePath.hasSuffix(
Expand Down
7 changes: 3 additions & 4 deletions ApprovalTests_SwiftTests/Namer/NamerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ final class NamerTests: XCTestCase {
try Approvals.verify("# Title\n> Quoted text", Approvals.Names.withParameters("story1").forFile.with(extensionWithDot: ".md"))
}

func test_parameters_async() async throws {
func test_parameters_async() async throws {
try Approvals.verify("# Title\n> Quoted text", Approvals.Names.withParameters("story1").forFile.with(extensionWithDot: ".md"))
}

func test_multipleParameters() throws {
let foo = Approvals.Names.withParameters("story1")
.and(Approvals.Names.withAdditionalParameters("part1"))
let name: String = foo.getNamer("", #function).sourceFilePath()
let foo = Approvals.Names.withParameters("story1").and(Approvals.Names.withAdditionalParameters("part1"))
let name = foo.getNamer("", #function).sourceFilePath()
XCTAssertEqual(name, ".test_multipleParameters.story1.part1")
}

Expand Down

0 comments on commit 6d47cf1

Please sign in to comment.