-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unit tests for
name_vec
and replace_non_ascii
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Run all tests in this script: | ||
## testthat::test_file(file.path("tests", "testthat", "test-name_vec.R")) | ||
|
||
# Error testing | ||
test_that("Errors work as desired", { | ||
expect_error(name_vec(content = NULL, name = NULL)) | ||
expect_error(name_vec(content = "x", name = NULL)) | ||
expect_error(name_vec(content = NULL, name = "name 1")) | ||
expect_error(name_vec(content = "x", name = c("name 1", "name 2"))) | ||
}) | ||
|
||
# # Warning testing | ||
# test_that("Warnings work as desired", { | ||
# # None in function | ||
# }) | ||
|
||
# # Message testing | ||
# test_that("Messages work as desired", { | ||
# # None in function | ||
# }) | ||
|
||
# # Output testing | ||
# test_that("Outputs are as expected", { | ||
# Skipping (for now) | ||
# }) |
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,23 @@ | ||
# Run all tests in this script: | ||
## testthat::test_file(file.path("tests", "testthat", "test-replace_non_ascii.R")) | ||
|
||
# Error testing | ||
test_that("Errors work as desired", { | ||
expect_error(replace_non_ascii(x = NULL, include_letters = FALSE)) | ||
expect_error(replace_non_ascii(x = 10, include_letters = FALSE)) | ||
}) | ||
|
||
# Warning testing | ||
test_that("Warnings work as desired", { | ||
expect_warning(replace_non_ascii(x = "aaa", include_letters = "false")) | ||
}) | ||
|
||
# Message testing | ||
# test_that("Messages work as desired", { | ||
# # None in function | ||
# }) | ||
|
||
# # Output testing | ||
# test_that("Outputs are as expected", { | ||
# # Skipping (for now) | ||
# }) |