Skip to content

Commit

Permalink
Unit tests for name_vec and replace_non_ascii
Browse files Browse the repository at this point in the history
  • Loading branch information
njlyon0 committed Jun 11, 2024
1 parent 718c92f commit 41f198a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/testthat/test-name_vec.R
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)
# })
23 changes: 23 additions & 0 deletions tests/testthat/test-replace_non_ascii.R
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)
# })

0 comments on commit 41f198a

Please sign in to comment.