Skip to content

Commit

Permalink
test: add example for case mentioned by @zkamvar
Browse files Browse the repository at this point in the history
  • Loading branch information
maelle committed Jan 10, 2025
1 parent 0dd4a10 commit 0bf6bf7
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
5 changes: 5 additions & 0 deletions inst/extdata/example-chunk-not-json.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
```{r echo=FALSE}
1+1
```

Blablabla.
7 changes: 7 additions & 0 deletions tests/testthat/_snaps/class-yarn/example-chunk-not-json.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```{r, echo=FALSE}
1+1
```

Blablabla.


14 changes: 14 additions & 0 deletions tests/testthat/test-class-yarn.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")

})

0 comments on commit 0bf6bf7

Please sign in to comment.