tests/testthat/test-rnw-tools.R

test_that("Convert Rnw to Rmd", {
    article_dir <- system.file("examples/sweave_article", package = "texor")
    dir.create(your_article_folder <- file.path(tempdir(), "tempdir"))
    x <- file.copy(from = article_dir, to = your_article_folder,recursive = TRUE)
    your_article_path <- paste(your_article_folder, "sweave_article", "example.Rnw",sep="/")
    your_article_path <- xfun::normalize_path(your_article_path)
    expect_equal(texor::rnw_to_rmd(your_article_path, output_format ="bookdown_vignette", clean_up = TRUE, autonumber_sec = FALSE), texor::pandoc_version_check())
    # expect_equal(file.exists(
    #                 xfun::normalize_path(
    #                     paste(your_article_folder, "sweave_article", "example.Rmd", sep="/"))),
    #              TRUE)
    unlink(your_article_folder, recursive = TRUE)
})

Try the texor package in your browser

Any scripts or data that you put into this service are public.

texor documentation built on Oct. 15, 2024, 5:08 p.m.