diff --git a/busted/modules/filter_loader.lua b/busted/modules/filter_loader.lua index e5c15182..5fb7fe7e 100644 --- a/busted/modules/filter_loader.lua +++ b/busted/modules/filter_loader.lua @@ -84,7 +84,7 @@ return function() if not (options.suppressPending and status == 'pending') then local fullname = getFullName() local trace = element.trace - if trace and trace.what == 'Lua' then + if trace and (trace.what == 'Lua' or trace.what == 'main') then fullname = trace.short_src .. ':' .. trace.currentline .. ': ' .. fullname end print(fullname) diff --git a/spec/cl_list.lua b/spec/cl_list.lua index c376ce45..ca97686b 100644 --- a/spec/cl_list.lua +++ b/spec/cl_list.lua @@ -1,5 +1,8 @@ -- supporting testfile; belongs to 'cl_spec.lua' +it('top-level test', function() +end) + describe('Tests list', function() it('test 1', function() end) diff --git a/spec/cl_spec.lua b/spec/cl_spec.lua index d5a6df28..a8ba62bc 100644 --- a/spec/cl_spec.lua +++ b/spec/cl_spec.lua @@ -183,17 +183,19 @@ describe('Tests the busted command-line options', function() it('tests running with -l specified', function() local _, _, result = executeBusted('-l --pattern=cl_list.lua$') - local expected = 'spec/cl_list.lua:4: Tests list test 1\n' .. - 'spec/cl_list.lua:7: Tests list test 2\n' .. - 'spec/cl_list.lua:10: Tests list test 3\n' + local expected = 'spec/cl_list.lua:3: top-level test\n' .. + 'spec/cl_list.lua:7: Tests list test 1\n' .. + 'spec/cl_list.lua:10: Tests list test 2\n' .. + 'spec/cl_list.lua:13: Tests list test 3\n' assert.is_equal(normpath(expected), result) end) it('tests running with --list specified', function() local _, _, result = executeBusted('--list --pattern=cl_list.lua$') - local expected = 'spec/cl_list.lua:4: Tests list test 1\n' .. - 'spec/cl_list.lua:7: Tests list test 2\n' .. - 'spec/cl_list.lua:10: Tests list test 3\n' + local expected = 'spec/cl_list.lua:3: top-level test\n' .. + 'spec/cl_list.lua:7: Tests list test 1\n' .. + 'spec/cl_list.lua:10: Tests list test 2\n' .. + 'spec/cl_list.lua:13: Tests list test 3\n' assert.is_equal(normpath(expected), result) end)