Skip to content

Commit

Permalink
Test import_sdtm
Browse files Browse the repository at this point in the history
  • Loading branch information
billdenney committed Feb 16, 2025
1 parent 9b6114e commit dc25d4d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions R/import_sdtm.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import_sdtm <- function(path,
extension_choice = c(".sas7bdat", ".xpt"),
ignore_case = TRUE,
auto_supp = FALSE,
...) {
stopifnot(
is.character(path),
Expand Down Expand Up @@ -54,6 +55,11 @@ import_sdtm <- function(path,
)
ret <- append_no_duplicate_names(ret, tmp_ret, method=stop)
}

if (auto_supp) {
browser()
stop()

Check warning on line 61 in R/import_sdtm.R

View check run for this annotation

Codecov / codecov/patch

R/import_sdtm.R#L60-L61

Added lines #L60 - L61 were not covered by tests
}
ret
}

Expand Down
Binary file added tests/testthat/example-sdtm/dm.xpt
Binary file not shown.
Binary file added tests/testthat/example-sdtm/suppdm.xpt
Binary file not shown.
17 changes: 17 additions & 0 deletions tests/testthat/test-import_sdtm.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This is how the example SDTM data were created
# rio::export(x = pharmaversesdtm::dm, file = test_path("example-sdtm/dm.xpt"))
# rio::export(x = pharmaversesdtm::suppdm, file = test_path("example-sdtm/suppdm.xpt"))

test_that("import_sdtm", {
# Automatically import a directory
expect_message(
import_sdtm(path = test_path("example-sdtm")),
regexp = "Detected domain SUPPDM from data."
)

# Import a single file
expect_message(
import_sdtm(path = test_path("example-sdtm/dm.xpt")),
regexp = "Detected domain DM from data."
)
})

0 comments on commit dc25d4d

Please sign in to comment.