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

testexec: subtest ("then-*") feature #7

Merged
merged 2 commits into from
Oct 21, 2021
Merged

Conversation

warpfork
Copy link
Owner

With this feature, naming a hunk in the pattern of {testname}/then-{subtestname}/script (when there's already a {testname}/script hunk, so testexec is already in motion) will cause subtests to run.

Subtests are more of the same, but have one especially useful feature: they start within a working directory that's a copy of the files and directories that were in the working directory of the parent test after it was finished.

Subtests can be nested -- {testname}/then-{subtestname}/then-{subsubtestname}/script -- in which case each of them continues getting a copy of the filesystem from the test that came before them....

... or, subtests can fan out -- {testname}/then-{subtestname}/script and {testname}/then-{othersubtestname}/script -- in which case each of them gets a copy of the parent, but separate copies, which do not interfere with each other.

This should help a great deal in writing tests for programs that have filesystem state. It can also be very useful for writing suites of tests for a program that needs some configuration files, and you don't want to repeat those every time: now you can just use the top level test to set up the config files, and then use a bunch of sibling subtests for all the actual testing work.

(This is itself... not yet tested. Don't rely on this commit hash; this PR may be rebased.)

…then-subtest feature.

One small fix, which makes sure it's fine for subtests to not
continue to add files using the file fixture mechanism,
which previously threw an NPE (whoopsie).
@warpfork
Copy link
Owner Author

Added self-test. Almost got a hole-in-one... but one nil pointer fix was needed. So close.

Works now.

@warpfork warpfork merged commit 99fe56e into master Oct 21, 2021
@warpfork warpfork deleted the testexec-then-feature branch October 21, 2021 19:49
@aschmahmann aschmahmann mentioned this pull request Dec 1, 2021
80 tasks
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