You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you run it with chaos dev.kaos it prints hello world. But when you run it with chaos -t dev.kaos it does not print hello world but instead executes the code below the tests: tag. If the assertion fails exits with a non-zero code.
Optionally; warn user if there are no assertions on sum function when they run chaos dev.kaos like:
$ chaos dev.kaos
Chaos Warning: `sum`functionis untested!
hello world
Add a CLI option to suppress these warnings.
The text was updated successfully, but these errors were encountered:
I say let's get this in. It reminds me of how Zig programmers code (tests in the same file, and can be invoked via the CLI). I really like this.
$ chaos dev.kaos
Chaos Warning: `sum`functionis not tested!
hello world
We can also change the wording to function is unused or untested!. I feel like this is better, because Chaos is built to encourage testing, but not everyone will want to write tests, especially for small programs. Adding unused seems a bit more semantically appropriate for certain cases.
@naltun I've updated the description to <FUNCTION_NAME> function is untested! format. Do you suggest to add another keyword like unused to ignore untested function warnings? Like a function decorator:
@unusednumdefsum(numa,numb)numc=a + breturncend
such that the Chaos Warning: sum function is not tested! message will be suppressed?
Add
assert
andtests
keyword to the grammar. Add-t/--test
CLI option. Consider the above Chaos program file:dev.kaos:
When you run it with
chaos dev.kaos
it printshello world
. But when you run it withchaos -t dev.kaos
it does not printhello world
but instead executes the code below thetests:
tag. If the assertion fails exits with a non-zero code.Optionally; warn user if there are no assertions on
sum
function when they runchaos dev.kaos
like:Add a CLI option to suppress these warnings.
The text was updated successfully, but these errors were encountered: