Replies: 1 comment
-
I'm supportive of the core idea. It seems like test declarations would basically be equivalent to function declarations. We could just add a |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Would be nice to have. I find myself wanting to write tests for Bash scripts, but too tedious to do. Writing tests in Python scripts is quite easy and painless.
I propose having tests be able to be defined in the same file, like how Rust and Zig allows you to do.
Something like this would be nice:
Some design concerns:
What about top-level statements
Will the
print
run on every test? Only run once? Not run at all?For this I'd say could take inspiration from Python's
__name__ == "__main__"
, but simplified to maybe "if amain()
function exists, then run that after loading the script file". So it'll be:Alternatively, could be some global variable from a module like:
What about test init/cleanup
For starters, just force the user be explicit. If this becomes a main pain-point, then revisit this.
Beta Was this translation helpful? Give feedback.
All reactions