tests/testthat/test-citation.R

test_that('nothing to cite', {
  .clearCited()
  expect_silent({
    .suggestCiteMethod(testModel1)
  })

  expect_silent({
    .suggestCiteMethod(testModel3)
  })
})


test_that('method citation', {
  skip_if_not_installed('kml')
  method = lcMethodKML('Y', id = 'Id', time = 'Time', nClusters = 3)
  .clearCited()

  options(latrend.cited.lcMethodKML = FALSE)
  expect_message({
    .suggestCiteMethod(method)
  }, 'lcMethodKML')

  # should not print on the second run
  expect_silent({
    .suggestCiteMethod(method)
  })

  # should not print when option is set
  .clearCited()
  options(latrend.cited.lcMethodKML = TRUE)
  expect_silent({
    .suggestCiteMethod(method)
  })
})


test_that('model citation on show', {
  skip_if_not_installed('kml')
  model = latrend(lcMethodTestKML(), testLongData)

  .clearCited()
  expect_message({
    capture.output({
      show(model)
    })
  }, 'lcModelKML')
})

Try the latrend package in your browser

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

latrend documentation built on May 29, 2024, 8:51 a.m.