Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolas Burkoff committed Jul 7, 2022
1 parent 4841de7 commit 56ecf81
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/testthat/test-get_rcode.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
testthat::test_that("get_rcode returns header only for empty chunks", {
ch <- teal.code::chunks_new()

r_code_from_chunks <- get_rcode(chunks = ch)
r_code_from_header <- sprintf("\n\n%s\n", paste(get_rcode_header(), collapse = "\n"))

# removing the Date line from the header as the seconds may be different
# in the two strings
testthat::expect_identical(
get_rcode(chunks = ch),
sprintf("\n\n%s\n", paste(get_rcode_header(), collapse = "\n"))
strsplit(r_code_from_chunks, "\n")[[1]][c(1:5, 7:14)],
strsplit(r_code_from_header, "\n")[[1]][c(1:5, 7:14)]
)
})

Expand Down

0 comments on commit 56ecf81

Please sign in to comment.