testwhat icon indicating copy to clipboard operation
testwhat copied to clipboard

In R markdown exercises, allow checking of text where there is no header

Open richierocks opened this issue 6 years ago • 0 comments

Inspired by ch1ex3 of Reporting with R Markdown.

The exercise asks students to change a line of text.

The old SCT was

test_rmd_group(1, {
  test_text("This is my first R Markdown document", not_called_msg = "Don't forget to change the first sentence to \"This is my first R Markdown document.\".")
})

There is no direct, "check" equivalent to test_rmd_group().

The best I could come up with is

ex() %>% check_rmd() %>% {
  check_code(., 'This is my first R Markdown document', fixed = TRUE, missing_msg = "Don't forget to change the first sentence to \"This is my first R Markdown document.\".")
}

The problem with this is that it doesn't pinpoint a region of text for the students to look at.

The closest test I can find is here, which uses check_header() to zoom in. Unfortunately, there is no header element in the document.

Is there a better solution than the one I found? Do we need a check_text_group() or check_paragraph() function? Or is this too niche to worry about?

richierocks avatar Feb 11 '19 19:02 richierocks