misconception: Test for a misconceived statement

Description Usage Arguments Examples

Description

Sometimes you expect a specific code pattern which might reflect a common misconception. misconception() let's you mark a pattern as such, causing the test to fail if the pattern is found.

Usage

1

Arguments

ex

A checkr result to use as input

pattern

A code pattern as found by any of the functions returning a checkr_result object.

message

The message to give if the pattern is found.

Examples

1
2
3
4
5
6
7
code <- for_checkr(quote({theta <- 53; x <- sin(theta)}))
misconception(code,
  line_where(code,
             passif(V == 53)),
  message = "Angle should be in degrees, not radians.")
misconception(code, line_calling(code, sin),
   message = "For the x-coordinate, use cos().")

dtkaplan/checkr documentation built on May 15, 2019, 4:59 p.m.