@@ -346,3 +346,39 @@ test_that("quickr_windows_add_dll_paths leaves PATH unchanged when complete", {
346346 expect_type(res , " character" )
347347 expect_identical(Sys.getenv(" PATH" ), base_path )
348348})
349+
350+ test_that(" quickr_windows_load_dll_dependencies preloads known runtime DLLs" , {
351+ temp <- withr :: local_tempdir()
352+ lib_dir <- file.path(temp , " lib" )
353+ bin_dir <- file.path(temp , " bin" )
354+ dir.create(lib_dir )
355+ dir.create(bin_dir )
356+ file.create(
357+ file.path(lib_dir , " libgfortran-5.dll" ),
358+ file.path(bin_dir , " libgfortran-5.dll" ),
359+ file.path(bin_dir , " libquadmath-0.dll" ),
360+ file.path(lib_dir , " Rlapack.dll" )
361+ )
362+
363+ loaded <- character ()
364+ res <- quickr_windows_load_dll_dependencies(
365+ c(lib_dir , bin_dir ),
366+ os_type = " windows" ,
367+ dyn_load = function (path ) {
368+ loaded <<- c(loaded , path )
369+ structure(list (), class = " DLLInfo" )
370+ }
371+ )
372+
373+ expected <- normalizePath(
374+ c(
375+ file.path(bin_dir , " libquadmath-0.dll" ),
376+ file.path(lib_dir , " libgfortran-5.dll" ),
377+ file.path(lib_dir , " Rlapack.dll" )
378+ ),
379+ winslash = " \\ " ,
380+ mustWork = FALSE
381+ )
382+ expect_identical(res , expected )
383+ expect_identical(loaded , expected )
384+ })
0 commit comments