/
utils-manifest.R
43 lines (37 loc) · 1.23 KB
/
utils-manifest.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
retrieve_manifest <- function ( ) {
# Refresh col_types with: OuhscMunge::readr_spec_aligned(path)
path <- system.file("manifest-testing.csv", package = "dataverse")
col_types <- readr::cols_only(
`subdataverse` = readr::col_character(),
`file_name` = readr::col_character(),
`size_bytes` = readr::col_integer(),
`location_expected` = readr::col_character(),
`compare_cells` = readr::col_logical(),
`md5` = readr::col_character()
)
d <- readr::read_csv(path, col_types = col_types)
d
}
# retrieve_manifest()
# checkmate::assert_fi
retrieve_file_expected <- function (subdataverse, file_name) {
path <-
file.path(subdataverse, file_name) %>%
system.file(package = "dataverse")
if (!file.exists(path)) {
stop(
"The testing file `",
file_name,
"` in the (sub)datavserse `",
subdataverse,
"` is not found. Please verify that the manifest is synced with the collection of test files. "
)
}
readr::read_file(path)
}
# retrieve_file_expected("rosters", "roster-bulls-1996.csv")
# compare_data_frame <- function (d_actual, d_expected) {
#
# # Compare cell contents
# testthat::expect_equal(d_actual, d_expected)
# }