tests/testthat/test-management_df_from_excel.R

#define path to dataset
internal_path <- "/extdata/EXAMPLE_data.xlsx"
path_to_xlsx_template <- system.file(internal_path, package = "SoilManageR")


test_that("input error", {
  expect_error(management_df_from_excel())
  expect_error(management_df_from_excel("wrong_path"))
  expect_error(management_df_from_excel(path_to_xlsx_template, var_sheet = "non_exisitng_sheet"))
})

test_that("test EXAMPLE data", {
  expect_equal(management_df_from_excel(path_to_xlsx_template),EXAMPLE_data)
})

#remove path to dataset
rm(internal_path,path_to_xlsx_template)

Try the SoilManageR package in your browser

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

SoilManageR documentation built on June 8, 2025, 9:36 p.m.