diff --git a/ci/test.lua b/ci/test.lua index bb12f6be1..01168800b 100644 --- a/ci/test.lua +++ b/ci/test.lua @@ -553,6 +553,7 @@ local function run_tests(tests, status, counts, config) goto skip end if not MODES[test.config.mode].detect() then + print(('Switching to %s mode for test: %s'):format(test.config.mode, test.name)) local ok, err = pcall(MODES[test.config.mode].navigate, config) if not ok then MODES[test.config.mode].failed = true diff --git a/plugins/lua/blueprint.lua b/plugins/lua/blueprint.lua index 57dee31fc..6aa154d2d 100644 --- a/plugins/lua/blueprint.lua +++ b/plugins/lua/blueprint.lua @@ -207,7 +207,7 @@ end -- returns the name of the output file for the given context function get_filename(opts, phase, ordinal) local fullname = 'dfhack-config/blueprints/' .. opts.name - local _,_,basename = fullname:find('/([^/]+)/?$') + local _,_,basename = opts.name:find('([^/]+)/*$') if not basename then -- should not happen since opts.name should already be validated error(('could not parse basename out of "%s"'):format(fullname)) diff --git a/test/library/gui/widgets.Label.lua b/test/library/gui/widgets.Label.lua index 75acba490..09ead7ad5 100644 --- a/test/library/gui/widgets.Label.lua +++ b/test/library/gui/widgets.Label.lua @@ -3,7 +3,7 @@ config.target = 'core' local gui = require('gui') local widgets = require('gui.widgets') -local fs = defclass(fs, gui.FramedScreen) +local fs = defclass(nil, gui.FramedScreen) fs.ATTRS = { frame_style = gui.GREY_LINE_FRAME, frame_title = 'TestFramedScreen', diff --git a/test/library/helpdb.lua b/test/library/helpdb.lua index bc482582c..7be2488df 100644 --- a/test/library/helpdb.lua +++ b/test/library/helpdb.lua @@ -1,4 +1,4 @@ -config.target = 'core' +--config.target = 'core' local h = require('helpdb') diff --git a/test/plugins/blueprint.lua b/test/plugins/blueprint.lua index 6146aea3f..35d32e1ff 100644 --- a/test/plugins/blueprint.lua +++ b/test/plugins/blueprint.lua @@ -1,3 +1,5 @@ +config.target = 'blueprint' + local b = require('plugins.blueprint') -- also covers code shared between parse_gui_commandline and parse_commandline @@ -117,9 +119,9 @@ function test.parse_gui_commandline() function() b.parse_gui_commandline({}, {''}) end) opts = {} - b.parse_gui_commandline(opts, {'imaname', 'dig', 'query'}) + b.parse_gui_commandline(opts, {'imaname', 'dig', 'place'}) expect.table_eq({auto_phase=false, format='minimal', split_strategy='none', - name='imaname', dig=true, query=true}, + name='imaname', dig=true, place=true}, opts) expect.error_match('unknown phase', @@ -203,9 +205,9 @@ function test.do_phase_positive_dims() function() local spos = {x=10, y=20, z=30} local epos = {x=11, y=21, z=31} - b.query(spos, epos, 'imaname') + b.place(spos, epos, 'imaname') expect.eq(1, mock_run.call_count) - expect.table_eq({'2', '2', '2', 'imaname', 'query', + expect.table_eq({'2', '2', '2', 'imaname', 'place', '--cursor=10,20,30'}, mock_run.call_args[1]) end) @@ -217,9 +219,9 @@ function test.do_phase_negative_dims() function() local spos = {x=11, y=21, z=31} local epos = {x=10, y=20, z=30} - b.query(spos, epos, 'imaname') + b.place(spos, epos, 'imaname') expect.eq(1, mock_run.call_count) - expect.table_eq({'2', '2', '-2', 'imaname', 'query', + expect.table_eq({'2', '2', '-2', 'imaname', 'place', '--cursor=10,20,31'}, mock_run.call_args[1]) end) @@ -231,9 +233,9 @@ function test.do_phase_ensure_cursor_is_at_upper_left() function() local spos = {x=11, y=20, z=30} local epos = {x=10, y=21, z=31} - b.query(spos, epos, 'imaname') + b.place(spos, epos, 'imaname') expect.eq(1, mock_run.call_count) - expect.table_eq({'2', '2', '2', 'imaname', 'query', + expect.table_eq({'2', '2', '2', 'imaname', 'place', '--cursor=10,20,30'}, mock_run.call_args[1]) end) @@ -241,16 +243,16 @@ end function test.get_filename() local opts = {name='a', split_strategy='none'} - expect.eq('blueprints/a.csv', b.get_filename(opts, 'dig', 1)) + expect.eq('dfhack-config/blueprints/a.csv', b.get_filename(opts, 'dig', 1)) opts = {name='a/', split_strategy='none'} - expect.eq('blueprints/a/a.csv', b.get_filename(opts, 'dig', 1)) + expect.eq('dfhack-config/blueprints/a/a.csv', b.get_filename(opts, 'dig', 1)) opts = {name='a', split_strategy='phase'} - expect.eq('blueprints/a-1-dig.csv', b.get_filename(opts, 'dig', 1)) + expect.eq('dfhack-config/blueprints/a-1-dig.csv', b.get_filename(opts, 'dig', 1)) opts = {name='a/', split_strategy='phase'} - expect.eq('blueprints/a/a-5-dig.csv', b.get_filename(opts, 'dig', 5)) + expect.eq('dfhack-config/blueprints/a/a-5-dig.csv', b.get_filename(opts, 'dig', 5)) expect.error_match('could not parse basename', function() b.get_filename({name='', split_strategy='none'}) diff --git a/test/plugins/cxxrandom.lua b/test/plugins/cxxrandom.lua index 6b11e1937..997cb2cb3 100644 --- a/test/plugins/cxxrandom.lua +++ b/test/plugins/cxxrandom.lua @@ -1,3 +1,5 @@ +config.target = 'cxxrandom' + local rng = require('plugins.cxxrandom') function test.cxxrandom_distributions() diff --git a/test/plugins/orders.lua b/test/plugins/orders.lua index a0959ae94..c5fae8eb2 100644 --- a/test/plugins/orders.lua +++ b/test/plugins/orders.lua @@ -1,4 +1,5 @@ config.mode = 'fortress' +--config.target = 'orders' local FILE_PATH_PATTERN = 'dfhack-config/orders/%s.json' diff --git a/test/plugins/workflow.lua b/test/plugins/workflow.lua index a03d1c2f6..8d0c69c68 100644 --- a/test/plugins/workflow.lua +++ b/test/plugins/workflow.lua @@ -1,3 +1,5 @@ +config.target = 'workflow' + local workflow = require('plugins.workflow') function test.job_outputs() diff --git a/test/quickfort/ecosystem.lua b/test/quickfort/ecosystem.lua index 3a4c014e4..bbe16319f 100644 --- a/test/quickfort/ecosystem.lua +++ b/test/quickfort/ecosystem.lua @@ -26,6 +26,7 @@ -- crashing the game. config.mode = 'fortress' +config.target = {'quickfort', 'blueprint', 'dig-now', 'tiletypes', 'gui/quantum'} local argparse = require('argparse') local gui = require('gui') diff --git a/test/structures/misc.lua b/test/structures/misc.lua index e93491d66..13febff56 100644 --- a/test/structures/misc.lua +++ b/test/structures/misc.lua @@ -28,7 +28,7 @@ function test.viewscreenDtors() for name, type in pairs(df) do if name:startswith('viewscreen') then print('testing', name) - v = type:new() + local v = type:new() expect.true_(v:delete(), "destructor returned false: " .. name) end end