Skip to content

Commit

Permalink
Revert "[#1251] Swifty generated variable names + fixed generated moc…
Browse files Browse the repository at this point in the history
…ks compi…"
  • Loading branch information
krzysztofzablocki committed Jan 9, 2024
1 parent 71c2d46 commit 738180b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 40 deletions.
8 changes: 2 additions & 6 deletions Templates/Templates/AutoMockable.stencil
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@ import {{ import }}
@testable import {{ import }}
{% endfor %}

{% macro cleanString string %}{{ string | replace:"(","_" | replace:")","" | replace:":","_" | replace:"`","" | replace:" ","_" | replace:"?","_" | replace:"!","_" | replace:",","_" | replace:"->","_" | replace:"@","_" | replace:".","_" | replace:"[","" | replace:"]","" | replace:"<","" | replace:">","" | snakeToCamelCase }}{% endmacro %}
{%- macro swiftifyMethodName method -%}
{%- set cleanMethodName %}{% call cleanString method.name %}{% endset %}
{%- set cleanMethodReturnTypeName %}{% call cleanString method.actualReturnTypeName.name %}{% endset -%}
{{ cleanMethodName | lowerFirstLetter }}{{ cleanMethodReturnTypeName | upperFirstLetter }}
{%- endmacro -%}
{% macro cleanString string %}{{ string | replace:"(","_" | replace:")","" | replace:":","_" | replace:"`","" | replace:" ","_" | replace:"?","_" | replace:"!","_" | replace:",","_" | replace:"->","_" | replace:"@","_" | replace:".","_" | replace:"[","" | replace:"]","" | snakeToCamelCase }}{% endmacro %}
{% macro swiftifyMethodName method %}{% call cleanString method.name | lowerFirstWord %}{% call cleanString method.actualReturnTypeName.name | upperFirstLetter %}{% endmacro %}

{% macro accessLevel level %}{% if level != 'internal' %}{{ level }} {% endif %}{% endmacro %}

Expand Down
5 changes: 0 additions & 5 deletions Templates/Tests/Context/AutoMockable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,3 @@ protocol SubscriptProtocol {
subscript<T: Hashable>(arg: T) -> T? { get set }
subscript<T>(arg: String) -> T? where T: Cancellable { get throws }
}

// sourcery: AutoMockable
public protocol ProtocolWithMethodWithGenericParameters {
func execute(param: Result<Int, Error>) -> Result<String, Error>
}
29 changes: 0 additions & 29 deletions Templates/Tests/Expected/AutoMockable.expected
Original file line number Diff line number Diff line change
Expand Up @@ -1526,33 +1526,4 @@ class VariablesProtocolMock: VariablesProtocol {
var universityMarks: [String: Int] = [:]


}
class ProtocolWithMethodWithGenericParameters: SomeProtocol {




//MARK: - execute

var executeParamResultIntErrorResultStringErrorCallsCount = 0
var executeParamResultIntErrorResultStringErrorCalled: Bool {
return executeParamResultIntErrorResultStringErrorCallsCount > 0
}
var executeParamResultIntErrorResultStringErrorReceivedParam: (Result<Int, Error>)?
var executeParamResultIntErrorResultStringErrorReceivedInvocations: [(Result<Int, Error>)] = []
var executeParamResultIntErrorResultStringErrorReturnValue: Result<String, Error>!
var executeParamResultIntErrorResultStringErrorClosure: ((Result<Int, Error>) -> Result<String, Error>)?

func execute(param: Result<Int, Error>) -> Result<String, Error> {
executeParamResultIntErrorResultStringErrorCallsCount += 1
executeParamResultIntErrorResultStringErrorReceivedParam = param
executeParamResultIntErrorResultStringErrorReceivedInvocations.append(param)
if let executeParamResultIntErrorResultStringErrorClosure = executeParamResultIntErrorResultStringErrorClosure {
return executeParamResultIntErrorResultStringErrorClosure(param)
} else {
return executeParamResultIntErrorResultStringErrorReturnValue
}
}


}

0 comments on commit 738180b

Please sign in to comment.