Skip to content

Commit

Permalink
check manipulateConfig with arbitrary settings
Browse files Browse the repository at this point in the history
  • Loading branch information
orichters committed Aug 6, 2024
1 parent 72c28ed commit c133b1b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/testthat/test_01-manipulateConfig.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit c133b1b

Please sign in to comment.