diff --git a/inst/extdata/example-chunk-not-json.md b/inst/extdata/example-chunk-not-json.md new file mode 100644 index 0000000..fa5c210 --- /dev/null +++ b/inst/extdata/example-chunk-not-json.md @@ -0,0 +1,5 @@ +```{r echo=FALSE} +1+1 +``` + +Blablabla. diff --git a/tests/testthat/_snaps/class-yarn/example-chunk-not-json.md b/tests/testthat/_snaps/class-yarn/example-chunk-not-json.md new file mode 100644 index 0000000..00ea0fc --- /dev/null +++ b/tests/testthat/_snaps/class-yarn/example-chunk-not-json.md @@ -0,0 +1,7 @@ +```{r, echo=FALSE} +1+1 +``` + +Blablabla. + + diff --git a/tests/testthat/test-class-yarn.R b/tests/testthat/test-class-yarn.R index 9a50b1f..3d2449e 100644 --- a/tests/testthat/test-class-yarn.R +++ b/tests/testthat/test-class-yarn.R @@ -203,3 +203,17 @@ test_that("TOML is preserved", { expect_snapshot_file(path, name = "example-json.md") }) + + +test_that("no metadata, chunk works", { + + pathmd <- system.file("extdata", "example-chunk-not-json.md", package = "tinkr") + y1 <- yarn$new(pathmd) + + expect_equal(length(y1$frontmatter), 0) + + path <- withr::local_tempfile() + y1$write(path) + expect_snapshot_file(path, name = "example-chunk-not-json.md") + +})