stackotter / swift-macro-toolkit

A powerful toolkit for creating concise and expressive Swift macros
Apache License 2.0
246 stars 15 forks source link

Transition to swift-macro-testing for Macro Testing #16

Closed ajkolean closed 6 months ago

ajkolean commented 6 months ago

This PR replaces SwiftSyntaxMacrosTestSupport with swift-macro-testing. It streamlines the macro testing process by introducing automated fixmes and better diagnostics.

Key changes include:

Additionally, this implementation demonstrates use of inline snapshotting tests, a technique used under the hood by the macro testing framework to verify the correctness of outputs directly within test cases. This approach can improve both the readability and accuracy of the tests.

Resolves #6

Benefits:

ajkolean commented 6 months ago

Awesome, thanks for the PR! Just a few requested changes (mostly to do with the literal parsing tests)

Updated. Yeah I wasn't sure about the TODO that was there. Seems like the best way to test that is actual patterns that would fail/pass the literal being passed. It might be possible to rebuild the pattern through reflection and assert on that. But that's usually brittle and the syntax tree is pretty gnarly.