diff --git a/tests/testthat/test-Lon2index.R b/tests/testthat/test-Lon2index.R index 8f530796f4911d759b3972a588fbcc265e59b763..e435deeb551f24d7c4a6c7dd42b8ae935794146e 100644 --- a/tests/testthat/test-Lon2index.R +++ b/tests/testthat/test-Lon2index.R @@ -1,4 +1,4 @@ -context("Generic tests") + test_that("Sanity checks", { expect_error(Lon2Index(lon = NULL), "Parameter 'lon' cannot be NULL.") expect_error(Lon2Index(lon = 'a'), "Parameter 'lon' must be numeric.") diff --git a/tests/testthat/test-Selbox.R b/tests/testthat/test-Selbox.R index fce7f0690d0f866881f57c8aaefb1a167b84fc6b..1b7b5a9e3f153ca2c4b4314f1374bb706d657eb6 100644 --- a/tests/testthat/test-Selbox.R +++ b/tests/testthat/test-Selbox.R @@ -1,4 +1,4 @@ -context("ClimProjDiags::SelBox tests") + ############################################## @@ -73,8 +73,8 @@ test_that("1. Input checks", { expect_warning( SelBox(array(1:10, dim = c(lon = 10, lat = 1)), region = region, lon = 1:10, lat = 1, londim = 1, latdim = 2), - "Numeric 'londim' is deprecated, use dimension names instead. The ", - "corresponding dimension name will be assigned." + paste0("Numeric 'londim' is deprecated, use dimension names instead. The ", + "corresponding dimension name will be assigned.") ) expect_error( SelBox(array(1:10, dim = c(lon = 10, lat = 1)), region = region, @@ -84,8 +84,8 @@ test_that("1. Input checks", { expect_warning( SelBox(array(1:10, dim = c(lon = 10, lat = 1)), region = region, lon = 1:10, lat = 1, londim = c('lon', 'lat'), latdim = 'lat'), - "Parameter 'londim' must be of length 1. Only the first value ", - "will be used." + paste0("Parameter 'londim' must be of length 1. Only the first value ", + "will be used.") ) expect_error( SelBox(array(1:10, dim = c(lons = 10, lat = 1)), region = region, @@ -102,8 +102,8 @@ test_that("1. Input checks", { expect_warning( SelBox(array(1:10, dim = c(lon = 10, lat = 1)), region = region, lon = 1:10, lat = 1, latdim = 2), - "Numeric 'latdim' is deprecated, use dimension names instead. The ", - "corresponding dimension name will be assigned." + paste0("Numeric 'latdim' is deprecated, use dimension names instead. The ", + "corresponding dimension name will be assigned.") ) expect_error( SelBox(array(1:10, dim = c(lon = 10, lat = 1)), region = region, @@ -113,8 +113,8 @@ test_that("1. Input checks", { expect_warning( SelBox(array(1:10, dim = c(lon = 10, lat = 1)), region = region, lon = 1:10, lat = 1, latdim = c('lat', 'lon')), - "Parameter 'latdim' must be of length 1. Only the first value ", - "will be used." + paste0("Parameter 'latdim' must be of length 1. Only the first value ", + "will be used.") ) expect_error( SelBox(array(1:10, dim = c(lon = 10, lats = 1)), region = region, diff --git a/tests/testthat/test-ShiftLon.R b/tests/testthat/test-ShiftLon.R index e414b5c9641fec7a05abd21cd980879459c77851..99b81e505df421b7af5f95d9f34f3f1e4de3aeb4 100644 --- a/tests/testthat/test-ShiftLon.R +++ b/tests/testthat/test-ShiftLon.R @@ -1,4 +1,4 @@ -context("ShiftLon tests") + ############################################## diff --git a/tests/testthat/test-Subset.R b/tests/testthat/test-Subset.R index 8144f96262ee9d76f32684565a9f1644a9979ba0..f9ec4187af2a517f8ce8032e6d36d1eb3663daa8 100644 --- a/tests/testthat/test-Subset.R +++ b/tests/testthat/test-Subset.R @@ -1,4 +1,4 @@ -context("Subset tests") + dat1 <- array(1:20, dim = c(dat = 1, lat = 2, lon = 10)) @@ -249,7 +249,7 @@ test_that("4. dat3", { expect_equal( Subset(dat1, 'dat', 1, drop = FALSE), Subset(dat3, 'dat', 1, drop = FALSE), -check.attributes = F +ignore_attr = T ) expect_equal( attributes(Subset(dat3, 'dat', 1, drop = FALSE)), @@ -270,7 +270,7 @@ list(dim = c(10), dimensions = c('lon')) expect_equal( Subset(dat1, c('lat', 'lon'), list(1, 2), drop = TRUE), Subset(dat3, c('lat', 'lon'), list(1, 2), drop = TRUE), -check.attributes = F +ignore_attr = T ) expect_equal( attributes(Subset(dat3, c('lat', 'lon'), list(1, 2), drop = TRUE)), diff --git a/tests/testthat/test-WeightedCells.R b/tests/testthat/test-WeightedCells.R index a5e9dd156e75f4833cf1f6707e293eb7e5a6ebf2..8f771f44c211b7618ba825788d8150bbbe06e9a6 100644 --- a/tests/testthat/test-WeightedCells.R +++ b/tests/testthat/test-WeightedCells.R @@ -1,4 +1,4 @@ -context("ClimProjDiags::WeightedCells tests") + ############################################## diff --git a/tests/testthat/test-WeightedMean.R b/tests/testthat/test-WeightedMean.R index 3edfcaec471e3caadeddb9e5fd8e2cdb5e646daf..4309710fa20a643d171f3223197eac41459ab588 100644 --- a/tests/testthat/test-WeightedMean.R +++ b/tests/testthat/test-WeightedMean.R @@ -1,4 +1,4 @@ -context("ClimProjDiags::WeightedMean tests") + ############################################## @@ -63,8 +63,8 @@ test_that("1. Input checks", { expect_warning( WeightedMean(array(1:10, dim = c(lon = 10, lat = 1)), lon = 1:10, lat = 1, londim = 1, latdim = 2), - "Numeric 'londim' is deprecated, use dimension names instead. The ", - "corresponding dimension name will be assigned." + paste0("Numeric 'londim' is deprecated, use dimension names instead. The ", + "corresponding dimension name will be assigned.") ) expect_error( WeightedMean(array(1:10, dim = c(lon = 10, lat = 1)), @@ -74,8 +74,8 @@ test_that("1. Input checks", { expect_warning( WeightedMean(array(1:10, dim = c(lon = 10, lat = 1)), lon = 1:10, lat = 1, londim = c('lon', 'lat'), latdim = 'lat'), - "Parameter 'londim' must be of length 1. Only the first value ", - "will be used." + paste0("Parameter 'londim' must be of length 1. Only the first value ", + "will be used.") ) expect_error( WeightedMean(array(1:10, dim = c(lons = 10, lat = 1)), @@ -92,8 +92,8 @@ test_that("1. Input checks", { expect_warning( WeightedMean(array(1:10, dim = c(lon = 10, lat = 1)), lon = 1:10, lat = 1, latdim = 2), - "Numeric 'latdim' is deprecated, use dimension names instead. The ", - "corresponding dimension name will be assigned." + paste0("Numeric 'latdim' is deprecated, use dimension names instead. The ", + "corresponding dimension name will be assigned.") ) expect_error( WeightedMean(array(1:10, dim = c(lon = 10, lat = 1)), @@ -103,8 +103,8 @@ test_that("1. Input checks", { expect_warning( WeightedMean(array(1:10, dim = c(lon = 10, lat = 1)), lon = 1:10, lat = 1, latdim = c('lat', 'lon')), - "Parameter 'latdim' must be of length 1. Only the first value ", - "will be used." + paste0("Parameter 'latdim' must be of length 1. Only the first value ", + "will be used.") ) expect_error( WeightedMean(array(1:10, dim = c(lon = 10, lats = 1)),