aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar mitchell <none@none>2021-11-30 14:52:50 -0500
committerGravatar mitchell <none@none>2021-11-30 14:52:50 -0500
commit68168e165079b95a3a7d24e21bf9a1250c801b16 (patch)
treeb165c21b44584714c50893375e8c4720735504a2 /test
parentb424a7e63cf35c31e3ba1a3b283f9d028b99dcd5 (diff)
Added optional argument to `textadept.editing.enclose()` to keep text selected.
Diffstat (limited to 'test')
-rw-r--r--test/test.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test.lua b/test/test.lua
index d81a3c0c..daffec91 100644
--- a/test/test.lua
+++ b/test/test.lua
@@ -1922,10 +1922,18 @@ function test_editing_enclose()
buffer:add_selection(buffer:position_from_line(2), buffer.line_end_position[2])
textadept.editing.enclose('-', '-')
assert_equal(buffer:get_text(), '-foo bar-\n-foo bar-')
+ assert(buffer.selection_empty, 'enclosed text still selected')
+ buffer:undo()
+ textadept.editing.enclose('*', '*', true)
+ assert_equal(buffer:get_sel_text(), 'bar')
+ textadept.editing.enclose('*', '*')
+ assert_equal(buffer:get_text(), 'foo **bar**\nfoo bar')
buffer:close(true)
assert_raises(function() textadept.editing.enclose() end, 'string expected, got nil')
assert_raises(function() textadept.editing.enclose('<', 1) end, 'string expected, got number')
+ assert_raises(function() textadept.editing.enclose('<', '>', 1) end,
+ 'boolean/nil expected, got number')
end
function test_editing_auto_enclose()