mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Handle multithreaded access crashes on unit tests using generated mocks
- always dispatch receivedInvocations mutations on the main queue
This commit is contained in:
committed by
Stefan Ceriu
parent
8b3141ffec
commit
b8dea8ac4e
@@ -24,11 +24,15 @@ import {{ import }}
|
||||
{% endset %}
|
||||
{% if method.parameters.count == 1 and not hasNonEscapingClosures %}
|
||||
{% call swiftifyMethodName method.selectorName %}Received{% for param in method.parameters %}{{ param.name | replace:"`","" | upperFirstLetter }} = {{ param.name | replace:"`","" }}{% endfor %}
|
||||
{% call swiftifyMethodName method.selectorName %}ReceivedInvocations.append({% for param in method.parameters %}{{ param.name }}){% endfor %}
|
||||
DispatchQueue.main.async {
|
||||
self.{% call swiftifyMethodName method.selectorName %}ReceivedInvocations.append({% for param in method.parameters %}{{ param.name }}){% endfor %}
|
||||
}
|
||||
{% else %}
|
||||
{% if not method.parameters.count == 0 and not hasNonEscapingClosures %}
|
||||
{% call swiftifyMethodName method.selectorName %}ReceivedArguments = ({% for param in method.parameters %}{{ param.name | replace:"`","" }}: {{ param.name | replace:"`","" }}{% if not forloop.last%}, {% endif %}{% endfor %})
|
||||
{% call swiftifyMethodName method.selectorName %}ReceivedInvocations.append(({% for param in method.parameters %}{{ param.name | replace:"`","" }}: {{ param.name | replace:"`","" }}{% if not forloop.last%}, {% endif %}{% endfor %}))
|
||||
DispatchQueue.main.async {
|
||||
self.{% call swiftifyMethodName method.selectorName %}ReceivedInvocations.append(({% for param in method.parameters %}{{ param.name | replace:"`","" }}: {{ param.name | replace:"`","" }}{% if not forloop.last%}, {% endif %}{% endfor %}))
|
||||
}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
@@ -24,11 +24,15 @@ import {{ import }}
|
||||
{% endset %}
|
||||
{% if method.parameters.count == 1 and not hasNonEscapingClosures %}
|
||||
{% call swiftifyMethodName method.selectorName %}Received{% for param in method.parameters %}{{ param.name | replace:"`","" | upperFirstLetter }} = {{ param.name | replace:"`","" }}{% endfor %}
|
||||
{% call swiftifyMethodName method.selectorName %}ReceivedInvocations.append({% for param in method.parameters %}{{ param.name }}){% endfor %}
|
||||
DispatchQueue.main.async {
|
||||
self.{% call swiftifyMethodName method.selectorName %}ReceivedInvocations.append({% for param in method.parameters %}{{ param.name }}){% endfor %}
|
||||
}
|
||||
{% else %}
|
||||
{% if not method.parameters.count == 0 and not hasNonEscapingClosures %}
|
||||
{% call swiftifyMethodName method.selectorName %}ReceivedArguments = ({% for param in method.parameters %}{{ param.name | replace:"`","" }}: {{ param.name | replace:"`","" }}{% if not forloop.last%}, {% endif %}{% endfor %})
|
||||
{% call swiftifyMethodName method.selectorName %}ReceivedInvocations.append(({% for param in method.parameters %}{{ param.name | replace:"`","" }}: {{ param.name | replace:"`","" }}{% if not forloop.last%}, {% endif %}{% endfor %}))
|
||||
DispatchQueue.main.async {
|
||||
self.{% call swiftifyMethodName method.selectorName %}ReceivedInvocations.append(({% for param in method.parameters %}{{ param.name | replace:"`","" }}: {{ param.name | replace:"`","" }}{% if not forloop.last%}, {% endif %}{% endfor %}))
|
||||
}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
Reference in New Issue
Block a user