Skip to content

FEATURE REQUEST for grade_this_code() #251

Open

Description

@garrettgman

I'd like to screen for particular failure modes in grade_this_code() to provide custom messages.

For example, in the example below, I'd like to provide a custom message instead of code_feedback() when the user submits censored[2, 3, 6].

```{r censored}
censored <- c(TRUE, NA, NA, FALSE, FALSE, NA, TRUE)
censored
```

```{r ref.label = "censored"}

```

```{r ph, exercise = TRUE, exercise.setup = "censored"}
censored
```

```{r ph-solution}
censored[c(2, 3, 6)]
```

```{r ph-check}
grade_this_code(
   fail_if_code_is(
    "censored[2, 3, 6]", 
    message = "Did you forget `c()`?", 
    ignore_white_spaces = TRUE
  )
)
```

This may be quickly withdrawn because I bet we can do it with a specific incantation in grade_this(), but might it be more helpful in grade_this_code()?

Activity

  1. added
    grade code
    on Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    grade code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions