# How do I test generated syntax against expected string in swift-syntax version 600?

**URL:** <https://forums.swift.org/t/how-do-i-test-generated-syntax-against-expected-string-in-swift-syntax-version-600/75450>\
**Category:** Source Tooling\
**Tags:** swift-syntax\
**Created:** [October 18, 2024, 9:09am UTC](https://forums.swift.org/t/how-do-i-test-generated-syntax-against-expected-string-in-swift-syntax-version-600/75450 "2024-10-18T09:09:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DJBen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/djben/32/32341_2.png) [@DJBen](https://forums.swift.org/u/DJBen)\
**Post date:** [October 18, 2024, 9:09am UTC](https://forums.swift.org/t/how-do-i-test-generated-syntax-against-expected-string-in-swift-syntax-version-600/75450/1 "2024-10-18T09:09:11Z")

</div>

I have CLI that codegen using swift-syntax. In swift-syntax 509 version, one can import the internal testing helper library and do this - it ought to generated a pretty-printed diff, nicer to compare large amount of string. I am not using swift-syntax with Swift Macros, so I feel I am out of option in version 600?

> <https://github.com/swiftlang/swift-syntax/blob/4db7cb20e63f4dba0b030068687996723e352874/Tests/SwiftSyntaxBuilderTest/Assertions.swift#L19>

---

<div class="post-metadata">

**Author:** ![ahoppen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/ahoppen/32/36046_2.png) [@ahoppen](https://forums.swift.org/u/ahoppen)\
**Post date:** [October 18, 2024, 5:33pm UTC](https://forums.swift.org/t/how-do-i-test-generated-syntax-against-expected-string-in-swift-syntax-version-600/75450/2 "2024-10-18T17:33:27Z")

</div>

I am not sure what you refer to. `assertBuildResult` has never been public API.

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [October 18, 2024, 7:21pm UTC](https://forums.swift.org/t/how-do-i-test-generated-syntax-against-expected-string-in-swift-syntax-version-600/75450/3 "2024-10-18T19:21:52Z")

</div>

I recommend the fantastic [`swift-macro-testing` library by PointFree](https://github.com/pointfreeco/swift-macro-testing).

---

<div class="post-metadata">

**Author:** ![DJBen](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/djben/32/32341_2.png) [@DJBen](https://forums.swift.org/u/DJBen)\
**Post date:** [October 25, 2024, 6:49pm UTC](https://forums.swift.org/t/how-do-i-test-generated-syntax-against-expected-string-in-swift-syntax-version-600/75450/4 "2024-10-25T18:49:38Z")

</div>

@Jon_Shier @ahoppen

Thank you both! I am not working with Swift Macros but a CLI tools that codegens using SwiftSyntax. After investigation and thanks to the pointer to PointFree tools, I opt in to use [GitHub - pointfreeco/swift-custom-dump: A collection of tools for debugging, diffing, and testing your application's data structures.](https://github.com/pointfreeco/swift-custom-dump) `expectNoDifference`. Turns out all I need is diffing XCAssert.
