diff --git a/test/old/testdir/samples/test_undo.txt b/test/old/testdir/samples/test_undo.txt new file mode 100644 index 0000000000..4cb29ea38f --- /dev/null +++ b/test/old/testdir/samples/test_undo.txt @@ -0,0 +1,3 @@ +one +two +three diff --git a/test/old/testdir/samples/test_undo.txt.undo b/test/old/testdir/samples/test_undo.txt.undo new file mode 100644 index 0000000000..cc3d3dd7c3 Binary files /dev/null and b/test/old/testdir/samples/test_undo.txt.undo differ diff --git a/test/old/testdir/test_undo.vim b/test/old/testdir/test_undo.vim index d876277850..b008c9216c 100644 --- a/test/old/testdir/test_undo.vim +++ b/test/old/testdir/test_undo.vim @@ -883,4 +883,33 @@ func Test_undo_range_normal() bwipe! endfunc +func Test_load_existing_undofile() + CheckFeature persistent_undo + sp samples/test_undo.txt + let mess=execute(':verbose rundo samples/test_undo.txt.undo') + call assert_match('Finished reading undo file', mess) + + call assert_equal(['one', 'two', 'three'], getline(1, '$')) + norm! u + call assert_equal(['one', 'two'], getline(1, '$')) + norm! u + call assert_equal(['one'], getline(1, '$')) + norm! u + call assert_equal([''], getline(1, '$')) + let mess = execute(':norm! u') + call assert_equal([''], getline(1, '$')) + call assert_match('Already at oldest change', mess) + exe ":norm! \" + call assert_equal(['one'], getline(1, '$')) + exe ":norm! \" + call assert_equal(['one', 'two'], getline(1, '$')) + exe ":norm! \" + call assert_equal(['one', 'two', 'three'], getline(1, '$')) + let mess = execute(":norm! \") + call assert_equal(['one', 'two', 'three'], getline(1, '$')) + call assert_match('Already at newest change', mess) + bw! +endfunc + + " vim: shiftwidth=2 sts=2 expandtab