aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2020-09-19 14:53:20 -0400
committerGravatar mitchell <70453897+orbitalquark@users.noreply.github.com>2020-09-19 14:53:20 -0400
commit14e524cf217250388d374433cf6f3241f66e4e01 (patch)
treebaa0c6f3c45cbd1946403a9762cadcffdb530ef7 /test
parent28a73bcf0fe6fa9cd97e50734fb243c625284a89 (diff)
Added `events.FILE_{BEFORE,AFTER}_RELOAD` and save/restore bookmarks.
Also moved buffer state save/restore into ui module.
Diffstat (limited to 'test')
-rw-r--r--test/modules/textadept/bookmarks/foo4
-rw-r--r--test/test.lua19
2 files changed, 23 insertions, 0 deletions
diff --git a/test/modules/textadept/bookmarks/foo b/test/modules/textadept/bookmarks/foo
new file mode 100644
index 00000000..94ebaf90
--- /dev/null
+++ b/test/modules/textadept/bookmarks/foo
@@ -0,0 +1,4 @@
+1
+2
+3
+4
diff --git a/test/test.lua b/test/test.lua
index 321df0bc..f3715a16 100644
--- a/test/test.lua
+++ b/test/test.lua
@@ -1153,6 +1153,25 @@ function test_bookmarks_interactive()
buffer:close(true)
end
+function test_bookmarks_reload()
+ local function has_bookmark(line)
+ return buffer:marker_get(line) & 1 << textadept.bookmarks.MARK_BOOKMARK - 1 > 0
+ end
+
+ io.open_file(_HOME .. '/test/modules/textadept/bookmarks/foo')
+ buffer:line_down()
+ textadept.bookmarks.toggle()
+ buffer:line_down()
+ buffer:line_down()
+ textadept.bookmarks.toggle()
+ assert(has_bookmark(2), 'line not bookmarked')
+ assert(has_bookmark(4), 'line not bookmarked')
+ buffer:reload()
+ assert(has_bookmark(2), 'bookmark not restored')
+ assert(has_bookmark(4), 'bookmark not restored')
+ buffer:close(true)
+end
+
function test_command_entry_run()
local command_run, tab_pressed = false, false
ui.command_entry.run(function(command) command_run = command end, {