-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest-file-check.R
40 lines (33 loc) · 1.62 KB
/
test-file-check.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
library(qwraps2)
e <- new.env()
example("file_check", local = e)
ls(envir = e)
################################################################################
# Test 1 #
stopifnot(isTRUE(e$test1))
stopifnot(identical(attr(e$test1, "checks")[, c("absolute_path")], c(FALSE, FALSE)))
stopifnot(identical(attr(e$test1, "checks")[, c("case_match")], c(TRUE, TRUE)))
stopifnot(identical(attr(e$test1, "checks")[, c("current_md5sum")], c("7a3409e17f9de067740e64448a86e708", "798e52b92e0ae0e60f3f3db1273235d0")))
stopifnot(identical(attr(e$test1, "checks")[, c("expected_md5sum")], c(NA_character_, NA_character_)))
stopifnot(identical(attr(e$test1, "checks")[, c("md5check")], c(NA,NA)))
################################################################################
# Test 2 #
# stopifnot(
# identical(
# e$test2
# ,
# TRUE
# )
# )
################################################################################
# test case match #
stopifnot(all.equal(unclass(e$test_case_match), FALSE, check.attributes = FALSE))
################################################################################
e$md5check3
################################################################################
# verify error is thrown when stop = TRUE
x <-
tryCatch(file_check(c("UNLIKELYFILENAME", "QWRAPS2_EXAMPLE_1.txt", "QWRAPS2_EXAMPLE_2.txt"), stop = TRUE)
, error = function(e) e )
stopifnot(!is.null(x))
stopifnot(inherits(x, "error"))