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

Compile fixture code with macro #282

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

sidepelican
Copy link
Collaborator

Currently, there are many Fixtures in the mockolo test code, but they are not statically checked by the compiler.
As a result, incorrect code may be tested.

In this PR, we introduce the @Fixture macro and change the tests to use actual Swift code.
The real Swift code will be validated for correctness at compile time, and the input and output of the tests will use the source code strings generated by the macro.

sidepelican and others added 24 commits November 21, 2024 18:15
# Conflicts:
#	Sources/MockoloFramework/Templates/ClosureTemplate.swift
#	Sources/MockoloFramework/Templates/NominalTemplate.swift
#	Tests/MockoloTestCase.swift
#	Tests/TestSendable/FixtureSendable.swift
# Conflicts:
#	Tests/MockoloTestCase.swift
#	Tests/TestActor/FixtureGlobalActor.swift
#	Tests/TestArgumentsHistory/FixtureArgumentsHistory.swift
#	Tests/TestEmojis/FixtureEmojis.swift
#	Tests/TestFuncs/TestBasicFuncs/FixtureNonSimpleFuncs.swift
#	Tests/TestFuncs/TestFuncAsync/FixtureFuncAsync.swift
#	Tests/TestOverloads/FixtureInheritance.swift
#	Tests/TestPATs/FixturePAT.swift
@sidepelican
Copy link
Collaborator Author

We don't replace all the tests in this PR. To validate the approach, only some of the tests have been updated.

@sidepelican sidepelican marked this pull request as draft December 9, 2024 09:53
@sidepelican
Copy link
Collaborator Author

The following two test cases have been commented out because they were incorrect (they won't be fixed in this PR):

  • variadicFunc
  • closureArgFunc

@sidepelican sidepelican marked this pull request as ready for review December 10, 2024 00:58
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.

1 participant