# NOT RUN {
file <- tempfile("pillar", fileext = ".txt")
# The pillar is constructed after options have been set
# (need two runs because reference file doesn't exist during the first run)
suppressWarnings(tryCatch(
expect_known_display(pillar(1:3), file, crayon = FALSE),
expectation_failure = function(e) {}
))
expect_known_display(pillar(1:3), file, crayon = FALSE)
# Good: Use tidyeval to defer construction
pillar_quo <- rlang::quo(pillar(1:3))
expect_known_display(!!pillar_quo, file, crayon = FALSE)
# }
# NOT RUN {
# Bad: Options set in the active session may affect the display
integer_pillar <- pillar(1:3)
expect_known_display(integer_pillar, file, crayon = FALSE)
# }
Run the code above in your browser using DataLab