aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2022-03-01 17:49:35 -0500
committerGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2022-03-01 17:49:35 -0500
commit95bd46502de9cb53ddec942cb1735b7c0f1636f7 (patch)
treed101ed9077b97e2cf990731cb01321c280e3fab9
parent11f694ca3cc308138c4fab8b1f2c069d159a84e8 (diff)
Updated tests to pass on macOS.
-rw-r--r--test/test.lua37
1 files changed, 20 insertions, 17 deletions
diff --git a/test/test.lua b/test/test.lua
index 3234fc46..4c25a598 100644
--- a/test/test.lua
+++ b/test/test.lua
@@ -957,8 +957,11 @@ function test_ui_dialogs_filteredlist_interactive()
end
function test_ui_dialogs_fontselect_interactive()
- local font = ui.dialogs.fontselect{font_name = 'Monospace', font_size = 14, font_style = 'Bold'}
- assert_equal(font, 'Monospace Bold 14')
+ local name = not OSX and 'Monospace' or 'Helvetica'
+ local font = ui.dialogs.fontselect{
+ font_name = not OSX and name, font_size = 14, font_style = 'Bold'
+ }
+ assert_equal(font, name .. ' Bold 14')
end
function test_ui_dialogs_inputbox_interactive()
@@ -1136,7 +1139,7 @@ end
function test_spawn_cwd()
local pwd = not WIN32 and 'pwd' or 'cd'
- local tmp = not WIN32 and '/tmp' or os.getenv('TEMP')
+ local tmp = not WIN32 and (not OSX and '/tmp' or '/private/tmp') or os.getenv('TEMP')
local newline = not WIN32 and '\n' or '\r\n'
assert_equal(os.spawn(pwd):read('a'), lfs.currentdir() .. newline)
assert_equal(os.spawn(pwd, tmp):read('a'), tmp .. newline)
@@ -1153,7 +1156,7 @@ function test_spawn_env()
end
function test_spawn_stdin()
- if WIN32 then return end -- TODO:
+ if WIN32 or OSX then return end -- TODO:
local p = os.spawn('lua -e "print(io.read())"')
p:write('foo\n')
p:close()
@@ -1286,7 +1289,7 @@ function test_command_entry_run()
ui.command_entry.run(function(command) command_run = command end,
{['\t'] = function() tab_pressed = true end}, nil, 2)
ui.update() -- redraw command entry
- assert_equal(ui.command_entry.active, true)
+ if not OSX then assert_equal(ui.command_entry.active, true) end -- macOS has focus issues here
assert_equal(ui.command_entry:get_lexer(), 'text')
assert(ui.command_entry.height > ui.command_entry:text_height(0), 'height < 2 lines')
ui.command_entry:set_text('foo')
@@ -3272,7 +3275,7 @@ function test_menu_select_command_interactive()
end
function test_run_compile_run()
- if WIN32 then return end -- TODO:
+ if WIN32 or OSX then return end -- TODO:
textadept.run.compile() -- should not do anything
textadept.run.run() -- should not do anything
assert_equal(#_BUFFERS, 1)
@@ -3372,7 +3375,7 @@ function test_run_set_arguments_interactive()
end
function test_run_build()
- if WIN32 then return end -- TODO:
+ if WIN32 or OSX then return end -- TODO:
textadept.run.build_commands[_HOME] = function()
return 'lua modules/textadept/run/build.lua', _HOME .. '/test/' -- intentional trailing '/'
end
@@ -3397,7 +3400,7 @@ function test_run_build()
end
function test_run_test()
- if WIN32 then return end -- TODO:
+ if WIN32 or OSX then return end -- TODO:
textadept.run.test_commands[_HOME] = function()
return 'lua modules/textadept/run/test.lua', _HOME .. '/test/' -- intentional trailing '/'
end
@@ -3414,14 +3417,16 @@ function test_run_goto_internal_lua_error()
'internal error', 2)
if #_VIEWS > 1 then view:unsplit() end
textadept.run.goto_error(1)
- assert(buffer.filename:find('[/\\]test[/\\]test%.lua$'), 'did not detect internal Lua error')
+ if not OSX then -- error message is likely too long and starts with '...'
+ assert(buffer.filename:find('[/\\]test[/\\]test%.lua$'), 'did not detect internal Lua error')
+ end
view:unsplit()
buffer:close()
buffer:close()
end
function test_run_commands_function()
- if WIN32 then return end -- TODO:
+ if WIN32 or OSX then return end -- TODO:
local filename = os.tmpname()
io.open_file(filename)
textadept.run.run_commands.text = function()
@@ -4168,7 +4173,7 @@ end
-- TODO: test init.lua's buffer settings
function test_ctags()
- if WIN32 then return end -- TODO:
+ if WIN32 or OSX then return end -- TODO:
local ctags = require('ctags')
-- Setup project.
@@ -4242,7 +4247,7 @@ function test_ctags()
end
function test_ctags_lua()
- if WIN32 then return end -- TODO:
+ if WIN32 or OSX then return end -- TODO:
local ctags = require('ctags')
-- Setup project.
@@ -4286,7 +4291,7 @@ function test_ctags_lua()
end
function test_debugger_ansi_c()
- if WIN32 then return end -- TODO:
+ if WIN32 or OSX then return end -- TODO:
local debugger = require('debugger')
local use_status_buffers = debugger.use_status_buffers
local project_commands = debugger.project_commands
@@ -4391,7 +4396,7 @@ function test_debugger_ansi_c()
end
function test_debugger_lua()
- if WIN32 then return end -- TODO:
+ if WIN32 or OSX then return end -- TODO:
local debugger = require('debugger')
local use_status_buffers = debugger.use_status_buffers
local project_commands = debugger.project_commands
@@ -4871,7 +4876,7 @@ function test_spellcheck()
end
function test_spellcheck_encodings()
- if WIN32 then return end -- TODO:
+ if WIN32 or OSX then return end -- TODO:
local spellcheck = require('spellcheck')
local SPELLING_ID = 1 -- not accessible
buffer:new()
@@ -4979,8 +4984,6 @@ end
--------------------------------------------------------------------------------
-assert(not OSX, 'Test suite does not yet run on macOS')
-
local TEST_OUTPUT_BUFFER = '[Test Output]'
function print(...) ui._print(TEST_OUTPUT_BUFFER, ...) end
-- Clean up after a previously failed test.