library(gradethis)
# Arguments passed to package functions are standardized
with_exercise(
mock_this_exercise(
.user_code = "purrr::map(1:10, rnorm, 1)",
.solution_code = "purrr::map(1:10, rnorm, mean = 1)"
),
code_feedback()
)
#> NULL
# Arguments passed to functions defined in setup aren't
with_exercise(
mock_this_exercise(
.user_code = "purrr::map(1:10, foo, 1)",
.solution_code = "purrr::map(1:10, foo, baz = 1)",
setup_exercise = foo <- function(bar, baz) bar + baz
),
code_feedback()
)
#> Your call to `purrr::map()` should include `"baz"` as one of its arguments. You may have misspelled an argument name, or left out an important argument.
# Arguments passed to functions defined in user code aren't
with_exercise(
mock_this_exercise(
.user_code = "
foo <- function(bar, baz) bar + baz
purrr::map(1:10, foo, 2)
",
.solution_code = "
foo <- function(bar, baz) bar + baz
purrr::map(1:10, foo, baz = 2)
"
),
code_feedback()
)
#> Your call to `purrr::map()` should include `"baz"` as one of its arguments. You may have misspelled an argument name, or left out an important argument.
Created on 2023-05-15 with reprex v2.0.2