styler (version 1.1.0)

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 comments and no verification can be conducted if scope > "line_breaks".

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

Run this code
# NOT RUN {
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")
# }

Run the code above in your browser using DataLab