knitr::opts_chunk$set(
  error = TRUE,
  collapse = TRUE,
  comment = "#>",
  out.width = "100%"
)
library(testthat)
library(jeksterslabRutils)
context("Test util_cat_sys.")

Parameters

year <- format(Sys.time(), "%Y")
knitr::kable(
  x = data.frame(
    Variable = "`year`",
    Description = "Current year.",
    Value = year
  ),
  row.names = FALSE
)

Run test

results <- capture.output(
  util_cat_sys(
    command = "date +%Y"
  )
)

Results

knitr::kable(
  x = data.frame(
    Description = "Current year.",
    Parameter = year,
    Result = results
  ),
  row.names = FALSE
)
test_that("util_cat_sys works", {
  expect_equivalent(
    results,
    year
  )
})


jeksterslabds/jeksterslabRutils documentation built on Jan. 18, 2021, 11:41 p.m.