diff --git a/tests/testthat/test_01-manipulateConfig.R b/tests/testthat/test_01-manipulateConfig.R index 62f423970..566c5a722 100644 --- a/tests/testthat/test_01-manipulateConfig.R +++ b/tests/testthat/test_01-manipulateConfig.R @@ -3,6 +3,15 @@ test_that("manipulate config with default configuration does not change main.gms cfg_init <- gms::readDefaultConfig("../..") tmpfile <- tempfile(pattern = "main-TESTTHAT-", tmpdir = "../..", fileext = ".gms") file.copy("../../main.gms", tmpfile) + + # generate arbitrary settings, manipulate file, read them again and check identity + cfg_new <- cfg_init + cfg_new$gms[names(cfg_new$gms)] <- rep(c(0, 1, "asdf", "bc3", "3bc"), length(cfg_new$gms))[1:length(cfg_new$gms)] + lucode2::manipulateConfig(tmpfile, cfg_new$gms) + cfg_new_after <- gms::readDefaultConfig("../..", basename(tmpfile)) + expect_equal(cfg_new_after, cfg_new) + + # reset to initial setting and check that nothing has changed at all in the file lucode2::manipulateConfig(tmpfile, cfg_init$gms) cfg_after <- gms::readDefaultConfig("../..", basename(tmpfile))