Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

verify_roundtrip

Verify the styling


Description

If scope was set to "line_breaks" or lower (compare tidyverse_style()), we can compare the expression before and after styling and return an error if it is not the same. Note that this method ignores roxygen code examples and comments and no verification can be conducted if tokens are in the styling scope.

Usage

verify_roundtrip(old_text, new_text)

Arguments

old_text

The initial expression in its character representation.

new_text

The styled expression in its character representation.

Examples

styler:::verify_roundtrip("a+1", "a + 1")
styler:::verify_roundtrip("a+1", "a + 1 # comments are dropped")
## Not run: 
styler:::verify_roundtrip("a+1", "b - 3")

## End(Not run)

styler

Non-Invasive Pretty Printing of R Code

v1.4.1
MIT + file LICENSE
Authors
Kirill Müller [aut], Lorenz Walthert [cre, aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.