[CHNOSZ-commits] r955 - in pkg/CHNOSZ: . R inst/tinytest man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Jan 7 11:25:44 CET 2026
Author: jedick
Date: 2026-01-07 11:25:43 +0100 (Wed, 07 Jan 2026)
New Revision: 955
Modified:
pkg/CHNOSZ/DESCRIPTION
pkg/CHNOSZ/R/util.data.R
pkg/CHNOSZ/inst/tinytest/test-util.data.R
pkg/CHNOSZ/man/util.data.Rd
Log:
Add tests for util.data.R
Modified: pkg/CHNOSZ/DESCRIPTION
===================================================================
--- pkg/CHNOSZ/DESCRIPTION 2026-01-07 09:21:10 UTC (rev 954)
+++ pkg/CHNOSZ/DESCRIPTION 2026-01-07 10:25:43 UTC (rev 955)
@@ -1,6 +1,6 @@
Date: 2026-01-07
Package: CHNOSZ
-Version: 2.2.0-21
+Version: 2.2.0-22
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/util.data.R
===================================================================
--- pkg/CHNOSZ/R/util.data.R 2026-01-07 09:21:10 UTC (rev 954)
+++ pkg/CHNOSZ/R/util.data.R 2026-01-07 10:25:43 UTC (rev 955)
@@ -6,7 +6,7 @@
#source("util.data.R")
#source("util.character.R")
-thermo.refs <- function(key = NULL, keep.duplicates = FALSE) {
+thermo.refs <- function(key = NULL, keep.duplicates = FALSE, browser = getOption("browser")) {
## Return references for thermodynamic data.
## 20110615 browse.refs() first version
## 20170212 thermo.refs() remove browsing (except for table of all sources)
@@ -128,8 +128,8 @@
.cat("</table></body></html>")
### End adaptation from print.findFn
# Show table in browser
- browseURL(File)
- cat("thermo.refs: table of references is shown in browser\n")
+ browseURL(File, browser = browser)
+ message("thermo.refs: table of references is shown in browser")
} else if(is.character(key)) {
# Return citation information for the given source(s)
# We omit the [S92] in "HDNB78 [S92]" etc.
Modified: pkg/CHNOSZ/inst/tinytest/test-util.data.R
===================================================================
--- pkg/CHNOSZ/inst/tinytest/test-util.data.R 2026-01-07 09:21:10 UTC (rev 954)
+++ pkg/CHNOSZ/inst/tinytest/test-util.data.R 2026-01-07 10:25:43 UTC (rev 955)
@@ -137,3 +137,29 @@
# temperatures and pressures of saturated and aromatic high molecular weight solid and liquid
# hydrocarbons in kerogen, bitumen, petroleum, and other organic matter of biogeochemical interest.
# Geochim. Cosmochim. Acta 62, 3591--3636. https://doi.org/10.1016/S0016-7037(97)00345-1
+
+# Tests added on 20260107
+
+info <- "thermo.refs() creates HTML table without error"
+# Create the HTML but divert the output to a NULL connection
+expect_silent(thermo.refs(browser = sink), info = info)
+# Turn off the connection
+sink()
+
+info <- "thermo.refs() returns reference for source key"
+expect_equal(thermo.refs("HDNB78")$key, "HDNB78", info = info)
+
+info <- "thermo.refs() returns reference for species index"
+expect_equal(thermo.refs(info("SiO2"))$key, "SHS89", info = info)
+
+info <- "thermo.refs() returns references for subcrt() species output"
+expect_equal(thermo.refs(subcrt("carrollite"))$key, "HDR+24", info = info)
+
+info <- "thermo.refs() returns references for subcrt() reaction output"
+expect_equal(thermo.refs(subcrt(c("oxygen", "O2"), c(-1, 1)))$key, c("WEP+82", "SHS89", "Kel60"), info = info)
+
+info <- "check.OBIGT() runs without error"
+expect_silent(out <- check.OBIGT(), info = info)
+
+info <- "dumpdata() runs without error"
+expect_silent(dd <- dumpdata(), info = info)
Modified: pkg/CHNOSZ/man/util.data.Rd
===================================================================
--- pkg/CHNOSZ/man/util.data.Rd 2026-01-07 09:21:10 UTC (rev 954)
+++ pkg/CHNOSZ/man/util.data.Rd 2026-01-07 10:25:43 UTC (rev 955)
@@ -14,7 +14,7 @@
}
\usage{
- thermo.refs(key = NULL, keep.duplicates = FALSE)
+ thermo.refs(key = NULL, keep.duplicates = FALSE, browser = getOption("browser"))
check.EOS(eos, model, prop, return.difference = TRUE)
check.GHS(ghs, return.difference = TRUE)
check.OBIGT()
@@ -26,6 +26,7 @@
\arguments{
\item{key}{character, numeric, or list; bibliographic reference key(s)}
\item{keep.duplicates}{logical, keep duplicated references?}
+ \item{browser}{character, name of browser to use (see \code{\link{browseURL}})}
\item{eos}{dataframe, equations-of-state parameters in the format of \code{thermo()$OBIGT}}
\item{model}{character, thermodynamic model (see \code{\link{thermo}})}
\item{prop}{character, property of interest (\samp{Cp} or \samp{V})}
More information about the CHNOSZ-commits
mailing list