@@ -74,3 +74,37 @@ test_that("quickr_fcompiler_env writes Makevars when flang is usable", {
7474 expect_true(startsWith(env , " R_MAKEVARS_USER=" ))
7575 expect_true(file.exists(sub(" R_MAKEVARS_USER=" , " " , env , fixed = TRUE )))
7676})
77+
78+ test_that(" quickr_windows_add_dll_paths updates PATH for Windows-style runs" , {
79+ temp <- withr :: local_tempdir()
80+ lib_dir <- file.path(temp , " lib" )
81+ bin_dir <- file.path(temp , " bin" )
82+ dir.create(lib_dir , recursive = TRUE )
83+ dir.create(bin_dir , recursive = TRUE )
84+
85+ withr :: local_envvar(PATH = " C:\\ Existing" )
86+ expect_true(quickr ::: quickr_windows_add_dll_paths(
87+ flags = paste0(" -L" , lib_dir ),
88+ os_type = " windows"
89+ ))
90+
91+ path <- strsplit(Sys.getenv(" PATH" ), " ;" , fixed = TRUE )[[1 ]]
92+ path_norm <- tolower(normalizePath(path , winslash = " \\ " , mustWork = FALSE ))
93+ lib_norm <- tolower(normalizePath(lib_dir , winslash = " \\ " , mustWork = FALSE ))
94+ bin_norm <- tolower(normalizePath(bin_dir , winslash = " \\ " , mustWork = FALSE ))
95+
96+ expect_true(lib_norm %in% path_norm )
97+ expect_true(bin_norm %in% path_norm )
98+ expect_false(quickr ::: quickr_windows_add_dll_paths(
99+ flags = paste0(" -L" , lib_dir ),
100+ os_type = " windows"
101+ ))
102+ })
103+
104+ test_that(" quickr_windows_add_dll_paths is a no-op outside Windows" , {
105+ withr :: local_envvar(PATH = " C:\\ Existing" )
106+ expect_false(quickr ::: quickr_windows_add_dll_paths(
107+ flags = " -Lfoo" ,
108+ os_type = " unix"
109+ ))
110+ })
0 commit comments