Last active
August 29, 2015 14:09
-
-
Save fwalch/00398a435d6efbe78eb4 to your computer and use it in GitHub Desktop.
improve-legacy2luatest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- test/functional/legacy/test61_spec.lua 2014-11-09 19:49:23.397789048 +0100 | |
+++ test/functional/legacy/061_test61_spec.lua 2014-11-09 19:46:03.460911121 +0100 | |
@@ -18,6 +18,7 @@ | |
123456789]]) | |
execute('echo undotree().entries') | |
+ -- Delete three characters and undo. | |
feed('Gx:set ul=100<cr>') | |
feed('x:set ul=100<cr>') | |
feed('x:.w! test.out<cr>') | |
@@ -25,9 +26,9 @@ | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
- -- :" | |
+ | |
execute('/^111/w >>test.out') | |
- -- :" Delete three other characters and go back in time step by step | |
+ -- Delete three other characters and go back in time step by step. | |
feed('$x:set ul=100<cr>') | |
feed('x:set ul=100<cr>') | |
feed('x:.w >>test.out<cr>') | |
@@ -41,9 +42,9 @@ | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('10g+:.w >>test.out<cr>') | |
- -- :" | |
+ | |
execute('/^222/w >>test.out') | |
- -- :" Delay for three seconds and go some seconds forward and backward | |
+ -- Delay for three seconds and go some seconds forward and backward. | |
execute('sleep 2') | |
feed('Aa<esc>:set ul=100<cr>') | |
feed('Ab<esc>:set ul=100<cr>') | |
@@ -57,8 +58,8 @@ | |
execute('.w >>test.out') | |
execute('later 1h') | |
execute('.w >>test.out') | |
- -- :" | |
- -- :" test undojoin | |
+ | |
+ -- Test undojoin. | |
feed('Goaaaa<esc>:set ul=100<cr>') | |
feed('obbbb<esc>u:.w >>test.out<cr>') | |
feed('obbbb<esc>:set ul=100<cr>') | |
@@ -71,22 +72,22 @@ | |
feed('otwo<esc>:set ul=100<cr>') | |
execute('w') | |
feed('othree<esc>:earlier 1f<cr>') | |
- -- :" expect "one one one\ntwo\ntwo" | |
+ -- Expect "one one one\ntwo\ntwo". | |
execute('%yank a') | |
execute('earlier 1f') | |
- -- :" expect "one one one" | |
+ -- Expect "one one one". | |
execute('%yank b') | |
execute('earlier 1f') | |
- -- :" expect empty line | |
+ -- Expect empty line. | |
execute('%yank c') | |
execute('later 1f') | |
- -- :" expect "one one one" | |
+ -- Expect "one one one". | |
execute('%yank d') | |
execute('later 1f') | |
- -- :" expect "one one one\ntwo\ntwo" | |
+ -- Expect "one one one\ntwo\ntwo". | |
execute('%yank e') | |
execute('later 1f') | |
- -- :" expect "one one one\ntwo\ntwo\nthree" | |
+ -- Expect "one one one\ntwo\ntwo\nthree". | |
feed('ggO---<esc>:0put e<cr>') | |
feed('ggO---<esc>:0put d<cr>') | |
feed('ggO---<esc>:0put c<cr>') | |
@@ -102,19 +103,16 @@ | |
execute('set ul=100') | |
feed([[o1<esc>a2=setline('.','1234')<cr>]]) | |
- -- . | |
feed('<esc>uu:<cr>') | |
feed('oc<esc>') | |
execute('set ul=100') | |
feed([[o1<esc>a2=setline('.','1234')<cr>]]) | |
- -- . | |
feed('<esc>u:<cr>') | |
feed('od<esc>') | |
execute('set ul=100') | |
feed('o1<esc>a2=string(123)<cr>') | |
- -- . | |
feed('<esc>u:<cr>') | |
execute('%w >>test.out') | |
execute('qa!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Tests for undo tree. | |
-- Since this script is sourced we need to explicitly break changes up in | |
-- undo-able pieces. Do that by setting 'undolevels'. | |
-- Also tests :earlier and :later. | |
local helpers = require('test.functional.helpers') | |
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert | |
local execute, expect = helpers.execute, helpers.expect | |
describe('test61', function() | |
setup(clear) | |
it('is working', function() | |
insert([[ | |
1111 ----- | |
2222 ----- | |
123456789]]) | |
execute('echo undotree().entries') | |
-- Delete three characters and undo. | |
feed('Gx:set ul=100<cr>') | |
feed('x:set ul=100<cr>') | |
feed('x:.w! test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
execute('/^111/w >>test.out') | |
-- Delete three other characters and go back in time step by step. | |
feed('$x:set ul=100<cr>') | |
feed('x:set ul=100<cr>') | |
feed('x:.w >>test.out<cr>') | |
execute('sleep 1') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('10g+:.w >>test.out<cr>') | |
execute('/^222/w >>test.out') | |
-- Delay for three seconds and go some seconds forward and backward. | |
execute('sleep 2') | |
feed('Aa<esc>:set ul=100<cr>') | |
feed('Ab<esc>:set ul=100<cr>') | |
feed('Ac<esc>:set ul=100<cr>') | |
execute('.w >>test.out') | |
execute('ear 1s') | |
execute('.w >>test.out') | |
execute('ear 3s') | |
execute('.w >>test.out') | |
execute('later 1s') | |
execute('.w >>test.out') | |
execute('later 1h') | |
execute('.w >>test.out') | |
-- Test undojoin. | |
feed('Goaaaa<esc>:set ul=100<cr>') | |
feed('obbbb<esc>u:.w >>test.out<cr>') | |
feed('obbbb<esc>:set ul=100<cr>') | |
execute('undojoin') | |
feed('occcc<esc>u:.w >>test.out<cr>') | |
execute('e! Xtest') | |
feed('ione one one<esc>:set ul=100<cr>') | |
execute('w!') | |
feed('otwo<esc>:set ul=100<cr>') | |
feed('otwo<esc>:set ul=100<cr>') | |
execute('w') | |
feed('othree<esc>:earlier 1f<cr>') | |
-- Expect "one one one\ntwo\ntwo". | |
execute('%yank a') | |
execute('earlier 1f') | |
-- Expect "one one one". | |
execute('%yank b') | |
execute('earlier 1f') | |
-- Expect empty line. | |
execute('%yank c') | |
execute('later 1f') | |
-- Expect "one one one". | |
execute('%yank d') | |
execute('later 1f') | |
-- Expect "one one one\ntwo\ntwo". | |
execute('%yank e') | |
execute('later 1f') | |
-- Expect "one one one\ntwo\ntwo\nthree". | |
feed('ggO---<esc>:0put e<cr>') | |
feed('ggO---<esc>:0put d<cr>') | |
feed('ggO---<esc>:0put c<cr>') | |
feed('ggO---<esc>:0put b<cr>') | |
feed('ggO---<esc>:0put a<cr>') | |
feed('ggO---<esc>:w >>test.out<cr>') | |
execute('so small.vim') | |
execute('set nocp viminfo+=nviminfo') | |
execute('enew!') | |
feed('oa<esc>') | |
execute('set ul=100') | |
feed('ob<esc>') | |
execute('set ul=100') | |
feed([[o1<esc>a2=setline('.','1234')<cr>]]) | |
feed('<esc>uu:<cr>') | |
feed('oc<esc>') | |
execute('set ul=100') | |
feed([[o1<esc>a2=setline('.','1234')<cr>]]) | |
feed('<esc>u:<cr>') | |
feed('od<esc>') | |
execute('set ul=100') | |
feed('o1<esc>a2=string(123)<cr>') | |
feed('<esc>u:<cr>') | |
execute('%w >>test.out') | |
execute('qa!') | |
-- Assert buffer contents. | |
expect([[ | |
456789 | |
3456789 | |
23456789 | |
123456789 | |
123456789 | |
1111 ----- | |
123456 | |
1234567 | |
12345678 | |
456789 | |
3456789 | |
23456789 | |
123456789 | |
123456789 | |
123456789 | |
123456 | |
2222 ----- | |
123456abc | |
123456 | |
123456789 | |
123456 | |
123456abc | |
aaaa | |
aaaa | |
--- | |
one one one | |
two | |
two | |
--- | |
one one one | |
--- | |
--- | |
one one one | |
--- | |
one one one | |
two | |
two | |
--- | |
one one one | |
two | |
two | |
three | |
a | |
b | |
c | |
12 | |
d]]) | |
end) | |
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Tests for undo tree. | |
-- Since this script is sourced we need to explicitly break changes up in | |
-- undo-able pieces. Do that by setting 'undolevels'. | |
-- Also tests :earlier and :later. | |
local helpers = require('test.functional.helpers') | |
local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert | |
local execute, expect = helpers.execute, helpers.expect | |
describe('test61', function() | |
setup(clear) | |
it('is working', function() | |
insert([[ | |
1111 ----- | |
2222 ----- | |
123456789]]) | |
execute('echo undotree().entries') | |
feed('Gx:set ul=100<cr>') | |
feed('x:set ul=100<cr>') | |
feed('x:.w! test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
-- :" | |
execute('/^111/w >>test.out') | |
-- :" Delete three other characters and go back in time step by step | |
feed('$x:set ul=100<cr>') | |
feed('x:set ul=100<cr>') | |
feed('x:.w >>test.out<cr>') | |
execute('sleep 1') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('g-:.w >>test.out<cr>') | |
feed('10g+:.w >>test.out<cr>') | |
-- :" | |
execute('/^222/w >>test.out') | |
-- :" Delay for three seconds and go some seconds forward and backward | |
execute('sleep 2') | |
feed('Aa<esc>:set ul=100<cr>') | |
feed('Ab<esc>:set ul=100<cr>') | |
feed('Ac<esc>:set ul=100<cr>') | |
execute('.w >>test.out') | |
execute('ear 1s') | |
execute('.w >>test.out') | |
execute('ear 3s') | |
execute('.w >>test.out') | |
execute('later 1s') | |
execute('.w >>test.out') | |
execute('later 1h') | |
execute('.w >>test.out') | |
-- :" | |
-- :" test undojoin | |
feed('Goaaaa<esc>:set ul=100<cr>') | |
feed('obbbb<esc>u:.w >>test.out<cr>') | |
feed('obbbb<esc>:set ul=100<cr>') | |
execute('undojoin') | |
feed('occcc<esc>u:.w >>test.out<cr>') | |
execute('e! Xtest') | |
feed('ione one one<esc>:set ul=100<cr>') | |
execute('w!') | |
feed('otwo<esc>:set ul=100<cr>') | |
feed('otwo<esc>:set ul=100<cr>') | |
execute('w') | |
feed('othree<esc>:earlier 1f<cr>') | |
-- :" expect "one one one\ntwo\ntwo" | |
execute('%yank a') | |
execute('earlier 1f') | |
-- :" expect "one one one" | |
execute('%yank b') | |
execute('earlier 1f') | |
-- :" expect empty line | |
execute('%yank c') | |
execute('later 1f') | |
-- :" expect "one one one" | |
execute('%yank d') | |
execute('later 1f') | |
-- :" expect "one one one\ntwo\ntwo" | |
execute('%yank e') | |
execute('later 1f') | |
-- :" expect "one one one\ntwo\ntwo\nthree" | |
feed('ggO---<esc>:0put e<cr>') | |
feed('ggO---<esc>:0put d<cr>') | |
feed('ggO---<esc>:0put c<cr>') | |
feed('ggO---<esc>:0put b<cr>') | |
feed('ggO---<esc>:0put a<cr>') | |
feed('ggO---<esc>:w >>test.out<cr>') | |
execute('so small.vim') | |
execute('set nocp viminfo+=nviminfo') | |
execute('enew!') | |
feed('oa<esc>') | |
execute('set ul=100') | |
feed('ob<esc>') | |
execute('set ul=100') | |
feed([[o1<esc>a2=setline('.','1234')<cr>]]) | |
-- . | |
feed('<esc>uu:<cr>') | |
feed('oc<esc>') | |
execute('set ul=100') | |
feed([[o1<esc>a2=setline('.','1234')<cr>]]) | |
-- . | |
feed('<esc>u:<cr>') | |
feed('od<esc>') | |
execute('set ul=100') | |
feed('o1<esc>a2=string(123)<cr>') | |
-- . | |
feed('<esc>u:<cr>') | |
execute('%w >>test.out') | |
execute('qa!') | |
-- Assert buffer contents. | |
expect([[ | |
456789 | |
3456789 | |
23456789 | |
123456789 | |
123456789 | |
1111 ----- | |
123456 | |
1234567 | |
12345678 | |
456789 | |
3456789 | |
23456789 | |
123456789 | |
123456789 | |
123456789 | |
123456 | |
2222 ----- | |
123456abc | |
123456 | |
123456789 | |
123456 | |
123456abc | |
aaaa | |
aaaa | |
--- | |
one one one | |
two | |
two | |
--- | |
one one one | |
--- | |
--- | |
one one one | |
--- | |
one one one | |
two | |
two | |
--- | |
one one one | |
two | |
two | |
three | |
a | |
b | |
c | |
12 | |
d]]) | |
end) | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment