diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index 147b1e14..1031feb9 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -248,3 +248,16 @@ test_that("as_mcmc.list() works", { "Currently only CmdStanMCMC objects can be converted to mcmc.list" ) }) + +test_that("get_cmdstan_flags() can be used recursively in `make`", { + tmp <- withr::local_tempfile() + writeLines( + "test:\n\t@Rscript --vanilla -e 'cat(cmdstanr:::get_cmdstan_flags(\"STANCFLAGS\"))'", + tmp + ) + nonrecursive_flags <- get_cmdstan_flags("STANCFLAGS") + recursive_flags <- readLines(textConnection(wsl_compatible_run( + command = "make", args = c("-f", tmp) + )$stdout)) + expect_equal(nonrecursive_flags, recursive_flags) +})