diff --git a/tests/testthat/_snaps/snapshot.md b/tests/testthat/_snaps/snapshot.md index eb044544e..09dc8308f 100644 --- a/tests/testthat/_snaps/snapshot.md +++ b/tests/testthat/_snaps/snapshot.md @@ -44,6 +44,14 @@ Error in `f()`: ! 4 +# line-endings fixed before comparison + + Code + cat(x) + Output + a + b + # multiple outputs of same type are collapsed Code diff --git a/tests/testthat/test-snapshot.R b/tests/testthat/test-snapshot.R index ab35726b4..ff15d1de4 100644 --- a/tests/testthat/test-snapshot.R +++ b/tests/testthat/test-snapshot.R @@ -30,6 +30,11 @@ test_that("empty lines are preserved", { expect_snapshot(f(), error = TRUE) }) +test_that("line-endings fixed before comparison", { + x <- "a\n\rb" + expect_snapshot(cat(x)) +}) + test_that("multiple outputs of same type are collapsed", { expect_snapshot({ x <- 1 diff --git a/tests/testthat/test-verify-output.R b/tests/testthat/test-verify-output.R index e9c5295ca..4a3c5889d 100644 --- a/tests/testthat/test-verify-output.R +++ b/tests/testthat/test-verify-output.R @@ -91,3 +91,9 @@ test_that("verify_exec() doesn't leave tempfiles around", { expect_equal(before, after) }) + +test_that("verify_exec() strips CR", { + act <- verify_exec(quote(cat("\r\n"))) + exp <- verify_exec(quote(cat("\n"))) + expect_equal(act[-1], exp[-1]) +})