@@ -365,14 +365,48 @@ describe("lls-addon", function()
365365 assert .contains ({ type = " vscode settings" , path = path (" fake" , " another.json" ) }, files )
366366 end )
367367
368- it (" does not look in projectDir if environment variables are defined and empty" , function ()
368+ it (" looks in projectDir if environment variables are defined and empty" , function ()
369369 stubFs ({
370370 current_dir = currentDir ,
371371 exists = pathEquals (path (currentDir , " .luarc.json" ), path (currentDir , " .vscode" , " settings.json" )),
372372 })
373373
374374 local files = findLuarcFiles (currentDir , { VSCSETTINGSPATH = " " , LUARCPATH = " " })
375- assert .are_same ({}, files )
375+ assert .are_equal (1 , # files )
376+ assert .contains ({ type = " luarc" , path = path (currentDir , " .luarc.json" ) }, files )
377+ end )
378+
379+ it (" looks in projectDir if environment variables are defined and empty" , function ()
380+ stubFs ({
381+ current_dir = currentDir ,
382+ exists = pathEquals (path (currentDir , " .luarc.json" ), path (currentDir , " .vscode" , " settings.json" )),
383+ })
384+
385+ local files = findLuarcFiles (currentDir , { VSCSETTINGSPATH = " " , LUARCPATH = " " })
386+ assert .are_equal (1 , # files )
387+ assert .contains ({ type = " luarc" , path = path (currentDir , " .luarc.json" ) }, files )
388+ end )
389+
390+ it (" looks in projectDir if only VSCSETTINGSPATH is defined and empty" , function ()
391+ stubFs ({
392+ current_dir = currentDir ,
393+ exists = pathEquals (path (currentDir , " .luarc.json" ), path (currentDir , " .vscode" , " settings.json" )),
394+ })
395+
396+ local files = findLuarcFiles (currentDir , { VSCSETTINGSPATH = " " })
397+ assert .are_equal (1 , # files )
398+ assert .contains ({ type = " luarc" , path = path (currentDir , " .luarc.json" ) }, files )
399+ end )
400+
401+ it (" looks in projectDir if only LUARCPATH is defined and empty" , function ()
402+ stubFs ({
403+ current_dir = currentDir ,
404+ exists = pathEquals (path (currentDir , " .luarc.json" ), path (currentDir , " .vscode" , " settings.json" )),
405+ })
406+
407+ local files = findLuarcFiles (currentDir , { LUARCPATH = " " })
408+ assert .are_equal (1 , # files )
409+ assert .contains ({ type = " luarc" , path = path (currentDir , " .luarc.json" ) }, files )
376410 end )
377411
378412 it (" does not look in projectDir if environment variables are defined as ';'" , function ()
@@ -385,23 +419,23 @@ describe("lls-addon", function()
385419 assert .are_same ({}, files )
386420 end )
387421
388- it (" does not look in projectDir if only VSCSETTINGSPATH is defined" , function ()
422+ it (" does not look in projectDir if only VSCSETTINGSPATH is defined as ';' " , function ()
389423 stubFs ({
390424 current_dir = currentDir ,
391425 exists = pathEquals (path (currentDir , " .luarc.json" ), path (currentDir , " .vscode" , " settings.json" )),
392426 })
393427
394- local files = findLuarcFiles (currentDir , { VSCSETTINGSPATH = " " })
428+ local files = findLuarcFiles (currentDir , { VSCSETTINGSPATH = " ; " })
395429 assert .are_same ({}, files )
396430 end )
397431
398- it (" does not look in projectDir if only LUARCPATH is defined" , function ()
432+ it (" does not look in projectDir if only LUARCPATH is defined as ';' " , function ()
399433 stubFs ({
400434 current_dir = currentDir ,
401435 exists = pathEquals (path (currentDir , " .luarc.json" ), path (currentDir , " .vscode" , " settings.json" )),
402436 })
403437
404- local files = findLuarcFiles (currentDir , { LUARCPATH = " " })
438+ local files = findLuarcFiles (currentDir , { LUARCPATH = " ; " })
405439 assert .are_same ({}, files )
406440 end )
407441 end )
0 commit comments