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

Option to keep going on error #125

Open
pbreheny opened this issue Nov 16, 2023 · 2 comments
Open

Option to keep going on error #125

pbreheny opened this issue Nov 16, 2023 · 2 comments

Comments

@pbreheny
Copy link

It would be nice if tinytest offered an option to continue testing a file or directory even if an error is encountered. For example, if we could run run_test_file('test.r') and get a message like:

20 tests  2 fails  1 error

if one of the tests was something like expect_equal(f(x), 3) and f(x) produced an error.

Just FYI, my specific use case here, which I admit is rather different from typical package testing, is that I'm using tinytest to grade student programming assignments. Sometimes their code crashes for various edge cases, but I still want to know how they did on the other cases. I realize that I can wrap the assertions in try()...this isn't bad, but kind of tedious / cluttered.

@markvanderloo
Copy link
Owner

markvanderloo commented Dec 29, 2023

Hi there,

In general we can not guarantee that code lines after an error are even possible to run, because that may depend on the previous lines having been executed correctly.

@pbreheny
Copy link
Author

Well, I certainly agree that stopping execution when an unexpected error is encountered must be the default. But similar to base R (catch.script.errors) and knitr (error=TRUE), I would argue that the option to keep going on errors is occasionally useful.

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

No branches or pull requests

2 participants