@@ -1641,7 +1641,39 @@ test_that("quickr_cached_r_cmd_config_value keys on Makeconf env refs", {
16411641 expect_equal(calls , 2L )
16421642})
16431643
1644- test_that(" quickr_cached_r_cmd_config_value retries dynamic Makeconf inputs" , {
1644+ test_that(" quickr_cached_r_cmd_config_value caches Makeconf make functions" , {
1645+ cache <- new.env(parent = emptyenv())
1646+ makeconf <- withr :: local_tempfile()
1647+ writeLines(
1648+ c(
1649+ " USE_LLVM =" ,
1650+ " CCBASE = $(if $(USE_LLVM),clang,gcc)" ,
1651+ " FC = $(CCBASE)"
1652+ ),
1653+ makeconf
1654+ )
1655+ calls <- 0L
1656+ local_mocked_bindings(
1657+ quickr_makeconf_path = function () makeconf ,
1658+ quickr_r_cmd_config_probe = function (name ) {
1659+ calls <<- calls + 1L
1660+ list (value = paste0(" value-" , calls ), ok = TRUE )
1661+ },
1662+ .package = " quickr"
1663+ )
1664+
1665+ expect_identical(
1666+ quickr_cached_r_cmd_config_value(" FC" , cache = cache ),
1667+ " value-1"
1668+ )
1669+ expect_identical(
1670+ quickr_cached_r_cmd_config_value(" FC" , cache = cache ),
1671+ " value-1"
1672+ )
1673+ expect_equal(calls , 1L )
1674+ })
1675+
1676+ test_that(" quickr_cached_r_cmd_config_value keys on dynamic Makeconf content" , {
16451677 cache <- new.env(parent = emptyenv())
16461678 root <- withr :: local_tempdir()
16471679 makeconf <- file.path(root , " Makeconf" )
@@ -1664,6 +1696,15 @@ test_that("quickr_cached_r_cmd_config_value retries dynamic Makeconf inputs", {
16641696 )
16651697
16661698 writeLines(" flang" , compiler_file )
1699+ expect_identical(
1700+ quickr_cached_r_cmd_config_value(" FC" , cache = cache ),
1701+ " value-1"
1702+ )
1703+
1704+ writeLines(
1705+ paste(" FC = $(shell cat" , compiler_file , " ) # changed" ),
1706+ makeconf
1707+ )
16671708 expect_identical(
16681709 quickr_cached_r_cmd_config_value(" FC" , cache = cache ),
16691710 " value-2"
0 commit comments