tests/testthat/test-remove.R

context("remove")

s <- system.file('examples/SAScode/Macros/Util2.SAS', package='sasMap')

sasCode <- loadSAS(s)

test_that("Removes multiline comments", {
  
  commentFree <- removeMultilineComments(sasCode)
 
  expect_false(stringr::str_detect(commentFree, "\\/\\*.*\\*\\/"))
  
})

test_that("Removes all comments", {
  
  commentFree <- removeAllComments(sasCode)
  
  expect_false(stringr::str_detect(commentFree, "this is a comment"))
  
})

test_that("Removes all whitespace", {
  
  noWhite <- removeWhitespaceCharacters(sasCode)

  expect_false(stringr::str_detect(noWhite, "\\\r|\\\n"))
  
})

Try the sasMap package in your browser

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

sasMap documentation built on May 2, 2019, 6:42 a.m.