Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ Imports:
rlang,
testthat,
utils,
xml2
xml2,
withr
Suggests:
baseline,
bookdown,
Expand Down
5 changes: 4 additions & 1 deletion R/DEPRECATED-read.mat.Witec.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ hySpc.testthat::test(read.mat.Witec) <- function() {
test_that(
"deprecated",
expect_warning(
expect_error(read.mat.Witec(file = ""), "Can only read a MAT file"),
expect_error(
with_envvar(list(LANGUAGE = "en_US"), read.mat.Witec(file = "")),
"Can only read a MAT file"
),
"deprecated|supports"
)
)
Expand Down
5 changes: 4 additions & 1 deletion R/DEPRECATED-read.spc.R
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,10 @@ hySpc.testthat::test(read.spc) <- function() {
test_that(
"deprecated",
expect_warning(
expect_error(read.spc(file = ""), "can only read"),
expect_error(
with_envvar(list(LANGUAGE = "en_US"), read.spc(file = "")),
"can only read"
),
"deprecated"
)
)
Expand Down
5 changes: 4 additions & 1 deletion R/DEPRECATED-read.spe.R
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,10 @@ hySpc.testthat::test(read.spe) <- function() {
test_that(
"deprecated",
expect_warning(
expect_error(read.spe(filename = ""), "can only read"),
expect_error(
with_envvar(list(LANGUAGE = "en_US"), read.spe(filename = "")),
"can only read"
),
"deprecated"
)
)
Expand Down
13 changes: 11 additions & 2 deletions R/DEPRECATED-read.txt.Renishaw.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ hySpc.testthat::test(read.txt.Renishaw) <- function() {
test_that(
"deprecated",
expect_warning(
expect_error(read.txt.Renishaw(file = ""), "cannot open"),
expect_error(
with_envvar(list(LANGUAGE = "en_US"), read.txt.Renishaw(file = "")),
"cannot open"
),
"deprecated"
)
)
Expand All @@ -199,7 +202,13 @@ hySpc.testthat::test(read.zip.Renishaw) <- function() {
test_that(
"deprecated",
expect_warning(
expect_error(read.zip.Renishaw(file = ""), "cannot open"),
expect_error(
with_envvar(
list(LANGUAGE = "en_US"),
read.zip.Renishaw(file = "")
),
"cannot open"
),
"deprecated"
)
)
Expand Down
5 changes: 4 additions & 1 deletion R/DEPRECATED-read.txt.Shimadzu.R
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,10 @@ hySpc.testthat::test(read.txt.Shimadzu) <- function() {
test_that(
"deprecated",
expect_warning(
expect_error(read.txt.Shimadzu(file = ""), "attempt to select"),
expect_error(
with_envvar(list(LANGUAGE = "en_US"), read.txt.Shimadzu(file = "")),
"attempt to select"
),
"deprecated"
)
)
Expand Down
6 changes: 5 additions & 1 deletion R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ setGeneric("plot")
#' @concept plot generation
#'
#' @export
#' @importFrom withr with_envvar
#' @examples
#'
#' plot(flu)
Expand Down Expand Up @@ -199,7 +200,10 @@ hySpc.testthat::test(.plot) <- function() {
expect_warning(plot(hy_spectra, "c"), "Intensity at first wavelengh only is used.")

# Regular tests: errors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
expect_error(plot(hy_spectra, "depth"), "object 'z' not found")
expect_error(
with_envvar(list(LANGUAGE = "en_US"), plot(hy_spectra, "depth")),
"object 'z' not found"
)
expect_error(plot(hy_spectra[0, ]), "No spectra.")
expect_error(plot(hy_spectra, xoffset = "a"), "xoffset must be a numeric")
expect_error(plot(hy_spectra, func = "a"), "func needs to be a function")
Expand Down