Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
Inspired by #67 (comment)
  • Loading branch information
jennybc committed Sep 11, 2018
1 parent a85849d commit eba1304
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/testthat/test-undo.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,18 @@ test_that("reprex_invert() can name outfile based on input filepath", {
out <- reprex_invert(input = "a_reprex.md", outfile = NA)
expect_identical(readLines("a_reprex_clean.R"), out)
})

test_that("reprex_invert(venue = 'gh') doesn't strip leading ws", {
skip_on_cran()
temporarily()
input <- c(
"library(magrittr)",
"mtcars[, 1:2] %>%",
" head(n = 1)"
)
reprexed <- reprex(
input = input, venue = "gh", advertise = FALSE, show = FALSE
)
inverted <- reprex_invert(reprexed, venue = "gh")
expect_match(inverted, input[3], all = FALSE, fixed = TRUE)
})

0 comments on commit eba1304

Please sign in to comment.