Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add unchecked Sendable conformance to AutoMockable #1355

Merged
merged 2 commits into from
Aug 8, 2024

Conversation

nekrich
Copy link
Contributor

@nekrich nekrich commented Aug 1, 2024

When protocol conforms to Sendable, Xcode generates an error for the Mock class:

Non-final class 'SendableProtocolMock' cannot conform to 'Sendable'; use '@unchecked Sendable'

This PR fixes the issue.

UPD 1: Updated linux sources for template tests.
UPD 2: Prettify templates test failures. Show actual differences line by line. Not like git diff, but much easier to navigate on failures.

@nekrich nekrich marked this pull request as ready for review August 1, 2024 13:46
@nekrich nekrich force-pushed the master branch 3 times, most recently from f54feed to 190cfbf Compare August 2, 2024 08:46
@nekrich
Copy link
Contributor Author

nekrich commented Aug 2, 2024

@art-divin , little changes:

  • Updated Linux sources for template tests.
  • Prettify templates test failures. Show actual differences line by line. It's not like git diff, but it's much easier to navigate on failures. It provides info on missing and unexpected lines in expected file:
        Sourcery/Templates/Tests/TemplatesTests.swift:111: error: -[TemplatesTests.TemplatesTests AutoMockable_template__generates_expected_code] : failed - Missing line in AutoMockable.expected:1460:
    class SendableProtocolMock: SendableProtocol, @unchecked Sendable {
    
    Sourcery/Templates/Tests/TemplatesTests.swift:111: error: -[TemplatesTests.TemplatesTests AutoMockable_template__generates_expected_code] : failed - Missing line in AutoMockable.expected:1463:
        var value: Any {
    
    Sourcery/Templates/Tests/TemplatesTests.swift:111: error: -[TemplatesTests.TemplatesTests AutoMockable_template__generates_expected_code] : failed - Missing line in AutoMockable.expected:1464:
            get { return underlyingValue }
    
    Sourcery/Templates/Tests/TemplatesTests.swift:111: error: -[TemplatesTests.TemplatesTests AutoMockable_template__generates_expected_code] : failed - Missing line in AutoMockable.expected:1465:
            set(value) { underlyingValue = value }
    
    Sourcery/Templates/Tests/TemplatesTests.swift:111: error: -[TemplatesTests.TemplatesTests AutoMockable_template__generates_expected_code] : failed - Missing line in AutoMockable.expected:1466:
        }
    
    Templates/Tests/TemplatesTests.swift:111: error: -[TemplatesTests.TemplatesTests AutoMockable_template__generates_expected_code] : failed - Missing line to AutoMockable.expected:1467:
        var underlyingValue: (Any)!
    
    Sourcery/Templates/Tests/TemplatesTests.swift:111: error: -[TemplatesTests.TemplatesTests AutoMockable_template__generates_expected_code] : failed - Missing line in AutoMockable.expected:1471:
    }
    

@krzysztofzablocki krzysztofzablocki merged commit f1974a5 into krzysztofzablocki:master Aug 8, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants