View source: R/check-description.R
check_has_desc_element | R Documentation |
Check that the DESCRIPTION fields provided by the student are correct.
check_has_desc_element(state, element, missing_msg = NULL, append = TRUE) check_desc_element_matches( state, element, regex, fixed = FALSE, times = 1L, not_typed_msg = NULL, append = TRUE ) check_desc_version( state, expected, bad_format_msg = NULL, incorrect_msg = NULL, append = TRUE ) check_desc_date( state, expected = Sys.Date(), bad_format_msg = NULL, incorrect_msg = NULL, append = TRUE ) check_desc_authors_at_r( state, expected, bad_format_msg = NULL, incorrect_msg = NULL, append = TRUE )
state |
The state of the exercise, as returned from |
element |
String naming the element of the roxygen block to check. |
missing_msg |
Optional string. Used to override the feedback message in the event of failure. |
append |
For compatibility; currently unused. |
regex |
String providing a regular expression for the solution code to
match. See |
fixed |
Logical. If |
times |
Positive integer. Denotes the number of times the string in
|
not_typed_msg |
Optional string. Used to override the feedback message in the event of failure. |
expected |
The expected value. |
bad_format_msg |
Optional string. Used to override the feedback message in the event of failure. incorrect_msg |
incorrect_msg |
Optional string. Used to override the feedback message in the event of failure. |
This function is invoked for the side effect of registering feedback
in the event of a failed test. See check_that
for details of
the return value and feedback mechanism.
check_has_desc_element
checks that the element
element of the
DESCRIPTION is present.
check_desc_element_equals
checks that the element
element of
the DESCRIPTION is equal to the value in the solution code.
check_desc_element_matches
checks that the element
element of
the DESCRIPTION matches a regular expression or string.
None of these functions use solution code. In order to facilitate this,
the design of check_desc_version
, check_desc_date
, and
check_desc_authors_at_r
differs from other testwhat check functions
in that they require an expected
argument, which takes the expected
value. This is coerced into a package_version
, Date
, or
person
object.
## Not run: # Always begin by calling parse_desc() on the exercise state. ex() %>% parse_desc() %>% { check_has_desc_element(., 'title') check_roxy_element_matches(., 'description', 'data.+manipulation') check_desc_version(., '1.0.0') check_desc_date(., '1919-10-18') check_desc_authors_at_r(., 'Richie Cotton <richie@datacamp.com> [cre, aut]' ) } ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.