-
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.
feat(R pkg): added validation for configuration values (#37)
* Added validation for configuration values * Failure of the configuration validation will now be mapped to a stop inside the R session instead of showing the raw Rust panic message Closes #36
- Loading branch information
Showing
9 changed files
with
206 additions
and
79 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# 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(tergo) | ||
|
||
testthat::test_check("tergo") | ||
|
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,24 @@ | ||
testthat::test_that("style_text validates the configuration", { | ||
testthat::expect_error( | ||
style_text( | ||
"1+1", | ||
configuration = list(line_length = 80), | ||
"Failed to style the text. Error: line_length configuration value must be an integer. Did you forget about L?" | ||
) | ||
) | ||
testthat::expect_error( | ||
style_text( | ||
"1+1", | ||
configuration = list(indent = 2), | ||
"Failed to style the text. Error: indent configuration value must be an integer. Did you forget about L?" | ||
) | ||
) | ||
testthat::expect_error( | ||
style_text( | ||
"1+1", | ||
configuration = list(embracing_op_no_nl = 2), | ||
"Failed to style the text. Error: embracing_op_no_nl configuration value must be a boolean." | ||
) | ||
) | ||
}) | ||
|