Skip to content

Commit

Permalink
Test function.
Browse files Browse the repository at this point in the history
  • Loading branch information
rfsaldanha committed Mar 25, 2024
1 parent 592ee71 commit 0f25842
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Imports:
tibble,
tidyr
Suggests:
jsonlite
jsonlite,
testthat (>= 3.0.0)
URL: https://rfsaldanha.github.io/rspell/
BugReports: https://github.com/rfsaldanha/rspell/issues
Config/testthat/edition: 3
12 changes: 12 additions & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is part of the standard setup for testthat.
# It is recommended that you do not modify it.
#
# Where should you do additional test configuration?
# Learn more about the roles of various files in:
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
# * https://testthat.r-lib.org/articles/special-files.html

library(testthat)
library(rspell)

test_check("rspell")
25 changes: 25 additions & 0 deletions tests/testthat/test-check_text.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
text_string <- "O rato roeu a roupa do rei de roma."

test_that("expect error if text is not set", {
expect_error(check_text(text = NULL))
})

test_that("expect error if text is not character", {
expect_error(check_text(text = TRUE))
})

test_that("expect error if language is not set", {
expect_error(check_text(text = text_string, language = NULL))
})

test_that("expect error if language is not set", {
expect_error(check_text(text = text_string, language = NULL))
})

test_that("expect error if language if not supported", {
expect_error(check_text(text = text_string, language = "blabla"))
})

test_that("expect a tibble as responde", {
expect_true(tibble::is_tibble(check_text(text = text_string, language = "pt-BR")))
})

0 comments on commit 0f25842

Please sign in to comment.