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

[#519] Implement a golden generator executable #549

Merged
merged 2 commits into from
Sep 18, 2021

Conversation

chshersh
Copy link
Contributor

This PR implements gg — a golden generator executable. It regenerates and updates on disk the content of all projects, scripts and default TOML config. It is useful when doing some massive boring updates (e.g. adding/removing GHC version support). With gg you can just change the main Summoner code and just run crun gg to update all the projects.

The second commit in this PR shows an example of updating years in all projects using gg.

It might be counter-intuitive to use gg to generate tests and then test against tests themselves. But the main idea is that you usually don't use gg after each change. Golden tests ensure that nothing changes unexpectedly. However, when changing e.g. GHC version you expect changes in golden tests. So you can quickly regenerate them, check the diff to verify that the changes look ok and submit them 🙂 If gg generated some unexpected results, you can always clean the mess with git because all the projects under the version control :octocat:

@chshersh chshersh added the tests Unit & Property tests label Sep 18, 2021
@chshersh chshersh requested a review from vrom911 as a code owner September 18, 2021 14:12
@chshersh chshersh self-assigned this Sep 18, 2021
Comment on lines +168 to +171
import: exe-options
hs-source-dirs: golden
main-is: Main.hs
build-depends: base
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't able to use common-options here because GHC outputs warning that base is not used in this executable (due to -Wunused-packages) 😒 So I don't use relude and warnings in this simple small file, just base, no ketchup, raw base

Copy link
Member

@vrom911 vrom911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this is huge work! Looks awesome, thank you! 👍🏼

@vrom911 vrom911 merged commit 19fb050 into main Sep 18, 2021
@vrom911 vrom911 deleted the chshersh/519-Implement-a-golden-generator-executable branch September 18, 2021 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Unit & Property tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants