Skip to content

Commit

Permalink
add test for #61 (this will fail)
Browse files Browse the repository at this point in the history
  • Loading branch information
zkamvar committed Mar 11, 2022
1 parent b7dbd5c commit b9bba20
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/testthat/test-asis-nodes.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,22 @@ test_that("multi-line inline math can have punctutation after", {
}
})


test_that("math with LaTeX protection will still work", {

expected <- c("Example 1: $a = \\begin{pmatrix} b \\\\ c \\end{pmatrix}$",
"Example 2: $f(x, \\, y)$",
"Example 3: $f(x, \\; y)$")
expected <- paste(expected, collapse = "\n\n")
math <- commonmark::markdown_xml(expected)
txt <- xml2::read_xml(math)
protxt <- protect_inline_math(txt, md_ns())
actual <- to_md(list(yaml = NULL, body = protxt))
expect_equal(actual, expected)

})


test_that("math with inline code still works", {

expected <- "some inline math, for example $R^2 = `r runif(1)`$, is failing with code\n"
Expand Down

0 comments on commit b9bba20

Please sign in to comment.