Skip to content
This repository was archived by the owner on Nov 20, 2020. It is now read-only.

Commit 6a01c53

Browse files
authoredAug 29, 2016
Merge pull request lunarmodules#531 from o-lim/file-not-found-error
Output error message when test file/dir not found
2 parents b0aa72c + b5060dd commit 6a01c53

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed
 

‎busted/languages/en.lua

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ s:set('output.success_single', 'success')
2626
s:set('output.seconds', 'seconds')
2727

2828
s:set('output.no_test_files_match', 'No test files found matching Lua pattern: %s')
29+
s:set('output.file_not_found', 'Cannot find file or directory: %s')
2930

3031
-- definitions following are not used within the 'say' namespace
3132
return {

‎busted/modules/test_file_loader.lua

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ return function(busted, loaders)
4343
end
4444
end)
4545
else
46+
busted.publish({ 'error' }, {}, nil, s('output.file_not_found'):format(rootFile), {})
4647
fileList = {}
4748
end
4849

‎spec/cl_spec.lua

+14
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,20 @@ describe('Tests error messages through the command line', function()
454454
assert.is_equal(expectedMsg, errmsg)
455455
end)
456456

457+
it('when test file not found', function()
458+
local _, _, result = executeBusted('--output=plainTerminal does_not_exist.lua')
459+
local errmsg = result:match('Error %-> (.-)\n')
460+
local expected = 'Cannot find file or directory: does_not_exist.lua'
461+
assert.is_equal(expected, errmsg)
462+
end)
463+
464+
it('when test directory not found', function()
465+
local _, _, result = executeBusted('--output=plainTerminal does_not_exist')
466+
local errmsg = result:match('Error %-> (.-)\n')
467+
local expected = 'Cannot find file or directory: does_not_exist'
468+
assert.is_equal(expected, errmsg)
469+
end)
470+
457471
it('when no test files matching Lua pattern', function()
458472
local _, _, result = executeBusted('--output=plainTerminal --pattern=this_filename_does_simply_not_exist$')
459473
local errmsg = result:match('Error %-> (.-)\n')

0 commit comments

Comments
 (0)
This repository has been archived.