misconception: Test for a misconceived statement

Description Usage Arguments Examples

View source: R/misconception.R

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
code <- for_checkr(quote({theta <- 53; x <- sin(theta)}))
misconception(code, line_where(code,V == 53), message = "Angle should be in degrees, not radians.")
misconception(code, line_calling(code, sin), message = "For the x-coordinate, use cos().")

dtkaplan/checkr2 documentation built on May 17, 2019, 4:01 p.m.