[CHNOSZ-commits] r409 - in pkg/CHNOSZ: . R tests/testthat
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Feb 24 00:25:27 CET 2019
Author: jedick
Date: 2019-02-24 00:25:27 +0100 (Sun, 24 Feb 2019)
New Revision: 409
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/R/retrieve.R
pkg/CHNOSZ/tests/testthat/test-retrieve.R
Log:
retrieve(): error messages include quotes around missing elements
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2019-02-23 22:58:22 UTC (rev 408)
+++ pkg/CHNOSZ/DESCRIPTION 2019-02-23 23:25:27 UTC (rev 409)
@@ -1,6 +1,6 @@
Date: 2019-02-23
Package: CHNOSZ
-Version: 1.2.0-16
+Version: 1.2.0-17
Title: Thermodynamic Calculations and Diagrams for Geochemistry
Authors at R: c(
person("Jeffrey", "Dick", , "j3ffdick at gmail.com", role = c("aut", "cre"),
Modified: pkg/CHNOSZ/R/retrieve.R
===================================================================
--- pkg/CHNOSZ/R/retrieve.R 2019-02-23 22:58:22 UTC (rev 408)
+++ pkg/CHNOSZ/R/retrieve.R 2019-02-23 23:25:27 UTC (rev 409)
@@ -29,8 +29,8 @@
for(elements in args) {
not.present <- ! elements %in% colnames(stoich)
if(any(not.present)) {
- if(sum(not.present)==1) stop(elements[not.present], " is not an element that is present in any species")
- else stop(paste(elements[not.present], collapse=", "), " are not elements that are present in any species")
+ if(sum(not.present)==1) stop('"', elements[not.present], '" is not an element that is present in any species')
+ else stop('"', paste(elements[not.present], collapse='", "'), '" are not elements that are present in any species')
}
# identify the species that have the elements
has.elements <- rowSums(stoich[, elements, drop = FALSE] != 0) == length(elements)
Modified: pkg/CHNOSZ/tests/testthat/test-retrieve.R
===================================================================
--- pkg/CHNOSZ/tests/testthat/test-retrieve.R 2019-02-23 22:58:22 UTC (rev 408)
+++ pkg/CHNOSZ/tests/testthat/test-retrieve.R 2019-02-23 23:25:27 UTC (rev 409)
@@ -2,9 +2,9 @@
test_that("errors and recalculations produce expected messages", {
# this should give an error about one non-element
- expect_error(retrieve(c("A", "B", "C")), "A is not an element")
+ expect_error(retrieve(c("A", "B", "C")), '"A" is not an element')
# this should give an error about two non-elements
- expect_error(retrieve(c("A", "B", "C", "D")), "A, D are not elements")
+ expect_error(retrieve(c("A", "B", "C", "D")), '"A", "D" are not elements')
# this should recalculate the stoichiometric matrix
add.obigt("SUPCRT92")
expect_message(retrieve("Ti"), "creating stoichiometric matrix")
More information about the CHNOSZ-commits
mailing list