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

Automatically generate main file for unit tests #653

Merged
merged 1 commit into from
Nov 16, 2023

Conversation

bartlomieju
Copy link
Contributor

This commit implements automatic generation of the main file (inko-tests.inko) for running unit tests. This file is placed in the build/ directory and is regenerated on each run. The file is not removed after the tests are run to allow inspection.

Changelog: added

Closes #575

@bartlomieju
Copy link
Contributor Author

I believe with this change std/test/main.inko can (and should) be removed.

@yorickpeterse yorickpeterse self-requested a review November 15, 2023 20:23
@yorickpeterse yorickpeterse force-pushed the auto_generate_test_file branch from cd8c684 to 2ae707c Compare November 15, 2023 23:58
@yorickpeterse
Copy link
Collaborator

yorickpeterse commented Nov 16, 2023

@bartlomieju Thanks for the changes! I made a couple of changed and amended those to your commit, then pushed it to your fork. I figured this was easier than writing a whole bunch of comments which you'd then have to piece together into actual code. These changes are largely style related, and the general idea of your implementation was fine 😄

I made the following changes:

  • Some formatting changes here and there (e.g. an empty line after a let that spans multiple lines)
  • I renamed a few of the new functions to be a bit shorter, and removed the comments as they weren't really needed
  • Some of the code could be condensed a bit, so I did that
  • The initial commit assumed the build/ directory was already in place, and would error if this wasn't the case. I fixed this by ensuring the build/ directory is created before the generated file is written
  • The test file generator is changed a bit to not create a bunch of intermediate String values by using push_str instead.
  • A few other minor (read: pedantic) changes

You can see the exact list of changes here. I'll merge the PR some time tomorrow in case I think of anything else overnight.

@bartlomieju
Copy link
Contributor Author

bartlomieju Thanks for the changes! I made a couple of changed and amended those to your commit, then pushed it to your fork. I figured this was easier than writing a whole bunch of comments which you'd then have to piece together into actual code. These changes are largely style related, and the general idea of your implementation was fine 😄

Totally and thanks! These changes make sense - since it's my first PR to the project I played it safe and erred on the verbose side :)

The initial commit assumed the build/ directory was already in place, and would error if this wasn't the case. I fixed this by ensuring the build/ directory is created before the generated file is written

Nice catch, I completely missed that!

I'll merge the PR some time tomorrow in case I think of anything else overnight.

SGTM; I assume you are going to delete std/test/main.inko in a follow up PR?

@yorickpeterse
Copy link
Collaborator

@bartlomieju

SGTM; I assume you are going to delete std/test/main.inko in a follow up PR?

And this is exactly why I wanted to wait with merging, I forgot about doing just that. Thanks for the reminder 😄

This commit implements automatic generation of the main file
(inko-tests.inko) for running unit tests. This file is placed
in the build/ directory and is regenerated on each run. The file
is not removed after the tests are run to allow inspection.

Changelog: added
@yorickpeterse yorickpeterse force-pushed the auto_generate_test_file branch from 2ae707c to da6ea1c Compare November 16, 2023 00:09
@yorickpeterse yorickpeterse merged commit 8f5ad1e into inko-lang:main Nov 16, 2023
21 checks passed
@yorickpeterse
Copy link
Collaborator

@bartlomieju Thanks!

@bartlomieju bartlomieju deleted the auto_generate_test_file branch November 16, 2023 14:44
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.

Automatically generate the main.inko file for unit tests
2 participants