All notable changes to the testwhat
project will be documented in this file. This project adheres to Semantic Versioning.
- Use Perl RegEx
- Add support for positional argument access (
check_arg(n)
) and...
element argument access (..n
) - Make
check_call
work with list args - Improve support for checking nested function calls
- Add optional parameter to force passing the
diagnose
tests incheck_correct
.
- Blacklisting removal introduced a bug that is now fixed.
- Checking a function call zooms in on the code for chained checking.
- Blacklisting has been removed as a mechanism to help match function calls.
- Automatic
ex() %>% check_error()
check after an SCT finished successfully, unlessallow_errors
is set toFALSE
by RBackend, which is the case if the exericse hasallow_solution_error()
in the pre-exercise-code - Explicitly export
disable_highlighting()
- Add example for test to check for function definitions
- Some typos in error messages (thanks Richie)
- Error out in case the first argument to any
check_
function is not a state, which happens if you forget the.
. - Error out if the code you pass in
override_solution()
does not parse. - Improve test coverage.
- Improve check_or/check_correct message if it is used incorrectly
- Error out in case
check_object()
is not used on root state (andTESTWHAT_V2_ONLY
set) - Error out in case
check_output_expr()
is not used on root state - Error out in case
check_function()
called oncheck_object()
- Error out in case
check_call()
not called oncheck_function_def()
- Error out in case
check_arg()
not called oncheck_function()
- New function
check_mc()
to use instead oftest_mc()
.
-
If
TESTWHAT_V2_ONLY=1
thetest_mc()
function will error out. -
test_correct()
,test_or()
will error out. -
If
TESTWHAT_V2_ONLY=1
, old skool usage ofcheck_correct()
andcheck_or()
will error out. You have to pipe inex()
:ex() %>% check_correct(...) ex() %>% check_or(...)
When executing old skool test_()
functions, testwhat
will now check the environment variable TESTWHAT_V2_ONLY
. If it is set to 1
, an error will be generated. This will effectively make test_()
functions unavailable for newer courses whose course image will have this environment variable baked in.
-
You can now pipe the state into
check_correct()
andcheck_or()
. These functions will then expose a special variable.
for the subtests to use:ex() %>% check_correct( check_object(., 'x') %>% check_equal(), check_function(., 'mean') %>% check_arg('x') %>% check_equal() )
-
You can specify custom equality functions to compare objects, function arguments and function results:
# solution x <- list(a = 1) # sct ex() %>% check_object('x') %>% check_equal(eq_fun = function(x, y) { x$a == x$b }) # submissions that will pass x <- list(a = 1) x <- data.frame(a = 1) x <- list(a = 1, b = 2)
- Support to test
h1
-level tags (starting with#
or underlined with=====
)
- Automated messaging around
check_header()
does not use theh<num>
reference, instead useslevel <num>
reference.
- Several functions to verify the correctness of exercises of the type
MarkdownExercise
, such ascheck_rmd()
,check_yaml()
,check_header()
,check_chunk()
andcheck_option()
. Together, they allow for a gradual 'zooming in' on particular parts of the markdown file submitted by the student and the markdown file contained in the solution. disable_highlighting()
: when used in an%>%
-based SCT chain, this disables highlighting for any checking functions that follow. If there is highlighting information for before thedisable_highlighting()
function, this will be used as a fallback.- Handle for integrating
testwhat
as a grader intolearnr
.
- Several improvements to documentation and vignettes overall.
- Support for
allow_extra
argument intest_yaml_header()
andtest_chunk_options()
, as they were used nowhere on the platform. These functions will soon be either removed or updated to depend on the new tidy markdown testing functions.
check_library()
:check_
equivalent fortest_library_function()
. Documentation has been udpated accordinglycheck_code()
now takes adrop_comments
argument. It defaults toFALSE
. If you set it toTRUE
, comments will be stripped from the student submission before the pattern you specified (fixed or not) is sought.
check_library()
(and by extensiontest_library_function()
) now ignorelibrary()
andrequire()
calls in comments.