aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2020-10-20 15:29:03 -0400
committerGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2020-10-20 15:29:03 -0400
commit03c4016d07477781aa3adcc9edf340c0bec9c6c8 (patch)
treed3be089e9020807326a4e56562876ecb7bcf7892 /test
parentb682fbd4a6e53185e2556686079532ad0e42be94 (diff)
Code cleanup.
Of note: * io.save_all_files() does not visit each buffer to save anymore. An unintended side-effect was checking for outside modification (but only if the file itself was modified), so outside changes will always be saved over now. * The menu clicked handler uses assert_type(), so the 'Unknown command' localization is no longer needed. * When printing to a new buffer type would split the view, use an existing split view when possible. * Prefer 'goto continue' construct in loops over nested 'if's. * Fixed clearing of ui.find.replace_entry_text on reset in the GUI version. * Fixed lack of statusbar updating when setting options like buffer EOL mode, indentation, and encoding. * Renamed internal new_snippet() to new() and put it in the snippet metatable.
Diffstat (limited to 'test')
-rw-r--r--test/test.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/test.lua b/test/test.lua
index 1505f2c2..047f6601 100644
--- a/test/test.lua
+++ b/test/test.lua
@@ -786,6 +786,23 @@ function test_ui_print()
ui.silent_print = silent_print
end
+function test_ui_print_to_other_view()
+ local silent_print = ui.silent_print
+
+ ui.silent_print = false
+ view:split()
+ ui.goto_view(-1)
+ assert_equal(_VIEWS[view], 1)
+ ui.print('foo') -- should print to other view, not split again
+ assert_equal(#_VIEWS, 2)
+ assert_equal(_VIEWS[view], 2)
+ buffer:close()
+ ui.goto_view(-1)
+ view:unsplit()
+
+ ui.silent_print = silent_print
+end
+
function test_ui_dialogs_colorselect_interactive()
local color = ui.dialogs.colorselect{title = 'Blue', color = 0xFF0000}
assert_equal(color, 0xFF0000)
@@ -1729,6 +1746,12 @@ function test_editing_transpose_chars()
buffer:char_left()
textadept.editing.transpose_chars()
assert_equal(buffer:get_text(), '⌘⇧⌥')
+ buffer:clear_all()
+ textadept.editing.transpose_chars()
+ assert_equal(buffer:get_text(), '')
+ buffer:add_text('a')
+ textadept.editing.transpose_chars()
+ assert_equal(buffer:get_text(), 'a')
-- TODO: multiple selection?
buffer:close(true)
end