-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Closes #223 Test code clean up * removing magrittr where it's not necessary * Order test files * updating documentations * Fixing the code style * fixing styler * Fixing lintr indentations issues * fixing Styler * Move package `readxl` to suggest
- Loading branch information
1 parent
394d74c
commit 473dbe9
Showing
18 changed files
with
577 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
## Test 1: xportr_df_label: deprecated metacore gives an error ---- | ||
test_that("deprecation Test 1: xportr_df_label: deprecated metacore gives an error", { | ||
local_options(lifecycle_verbosity = "quiet") | ||
df <- data.frame(x = "a", y = "b") | ||
df_meta <- data.frame(dataset = "df", label = "Label") | ||
|
||
expect_error(xportr_df_label(df, metacore = df_meta)) | ||
}) | ||
|
||
## Test 2: xportr_format: deprecated metacore gives an error ---- | ||
test_that("deprecation Test 2: xportr_format: deprecated metacore gives an error", { | ||
local_options(lifecycle_verbosity = "quiet") | ||
df <- data.frame(x = 1, y = 2) | ||
df_meta <- data.frame( | ||
dataset = "df", | ||
variable = "x", | ||
format = "date9." | ||
) | ||
|
||
expect_error(xportr_format(df, metacore = df_meta)) | ||
}) | ||
|
||
## Test 3: xportr_label: using the deprecated metacore argument gives an error ---- | ||
test_that( | ||
"deprecation Test 3: xportr_label: using the deprecated metacore argument gives an error", | ||
{ | ||
local_options(lifecycle_verbosity = "quiet") | ||
|
||
df <- data.frame(x = "a", y = "b") | ||
df_meta <- | ||
data.frame( | ||
dataset = "df", | ||
variable = "x", | ||
label = "foo" | ||
) | ||
|
||
expect_error(xportr_label(df, metacore = df_meta)) | ||
} | ||
) | ||
|
||
## Test 4: xportr_length: using the deprecated metacore argument gives an error ---- | ||
test_that( | ||
"deprecation Test 4: xportr_length: using the deprecated metacore argument gives an error", | ||
{ | ||
local_options(lifecycle_verbosity = "quiet") | ||
df <- data.frame(x = "a", y = "b") | ||
df_meta <- data.frame( | ||
dataset = "df", | ||
variable = c("x", "y"), | ||
type = c("text", "text"), | ||
length = c(1, 2) | ||
) | ||
|
||
expect_error(xportr_length(df, metacore = df_meta)) | ||
} | ||
) | ||
|
||
## Test 5: xportr_order: using the deprecated metacore argument gives an error ---- | ||
test_that( | ||
"deprecation Test 5: xportr_order: using the deprecated metacore argument gives an error", | ||
{ | ||
local_options(lifecycle_verbosity = "quiet") | ||
|
||
df <- data.frame( | ||
c = 1:5, | ||
a = "a", | ||
d = 5:1, | ||
b = LETTERS[1:5] | ||
) | ||
df_meta <- data.frame( | ||
dataset = "DOMAIN", | ||
variable = letters[1:4], | ||
order = 1:4 | ||
) | ||
|
||
expect_error(xportr_order(df, metacore = df_meta, domain = "DOMAIN")) | ||
} | ||
) | ||
|
||
## Test 6: xportr_type: using the deprecated metacore argument gives an error ---- | ||
test_that( | ||
"deprecation Test 6: xportr_type: using the deprecated metacore argument gives an error", | ||
{ | ||
local_options(lifecycle_verbosity = "quiet") | ||
df <- data.frame( | ||
Subj = as.character(c(123, 456, 789, "", NA, NA_integer_)), | ||
Different = c("a", "b", "c", "", NA, NA_character_), | ||
Val = c("1", "2", "3", "", NA, NA_character_), | ||
Param = c("param1", "param2", "param3", "", NA, NA_character_) | ||
) | ||
df_meta <- data.frame( | ||
dataset = "df", | ||
variable = c("Subj", "Param", "Val", "NotUsed"), | ||
type = c("numeric", "character", "numeric", "character"), | ||
format = NA | ||
) | ||
|
||
expect_error(xportr_type(df, metacore = df_meta)) | ||
} | ||
) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.