test_that("xportr_format: error when metadata is not set", { adsl <- data.frame( USUBJID = c(1001, 1002, 1003), BRTHDT = c(1, 1, 2) ) expect_error( xportr_format(adsl), regexp = "Metadata must be set with `metadata` or `xportr_metadata\\(\\)`" ) }) test_that("xportr_format: Gets warning when metadata has multiple rows with same variable", { # This test uses the (2) functions below to reduce code duplication # All `expect_*` are being called inside the functions # # Checks that message appears when xportr.domain_name is invalid multiple_vars_in_spec_helper(xportr_format) # Checks that message doesn't appear when xportr.domain_name is valid multiple_vars_in_spec_helper2(xportr_format) })