@@ -653,6 +653,23 @@ T['get()']['can be used without `setup()`'] = function()
653653 eq (child .lua_get (' { require("mini.icons").get("default", "file") }' ), { ' ' , ' MiniIconsGrey' , false })
654654end
655655
656+ T [' get()' ][' works with deleted cwd' ] = function ()
657+ local temp_dir = ' tests/dir-icons/temp'
658+ vim .fn .mkdir (temp_dir , ' p' )
659+ MiniTest .finally (function () vim .fn .delete (temp_dir , ' rf' ) end )
660+
661+ local file_path = child .fn .fnamemodify (' tests/dir-icons/file.txt' , ' :p' )
662+ child .fn .chdir (temp_dir )
663+ vim .fn .delete (temp_dir , ' rf' )
664+
665+ -- Should use `vim.filetype.match` without errors due to missing cwd
666+ eq (get (' extension' , ' xpm' ), { ' ' , ' MiniIconsYellow' , false })
667+ eq (get (' extension' , ' unknown' ), { ' ' , ' MiniIconsGrey' , true })
668+ eq (get (' file' , ' hello.tcsh' ), { ' ' , ' MiniIconsAzure' , false })
669+ eq (get (' file' , file_path ), { ' ' , ' MiniIconsYellow' , false })
670+ eq (get (' file' , ' does-not-exist' ), { ' ' , ' MiniIconsGrey' , true })
671+ end
672+
656673T [' get()' ][' handles deleting all buffers' ] = function ()
657674 -- As `vim.filetype.match()` requries a buffer to be more useful, make sure
658675 -- that there is a persistent helper buffer
0 commit comments