From c152cdd0f34c10b3d3a8007838561556578685c6 Mon Sep 17 00:00:00 2001 From: Rainer Borene Date: Thu, 6 Nov 2014 21:21:03 -0200 Subject: [PATCH 01/14] legacy tests: migrate test5 --- src/nvim/testdir/test5.in | 29 -------- src/nvim/testdir/test5.ok | 9 --- .../legacy/005_bufleave_delete_buffer.lua | 71 +++++++++++++++++++ 3 files changed, 71 insertions(+), 38 deletions(-) delete mode 100644 src/nvim/testdir/test5.in delete mode 100644 src/nvim/testdir/test5.ok create mode 100644 test/functional/legacy/005_bufleave_delete_buffer.lua diff --git a/src/nvim/testdir/test5.in b/src/nvim/testdir/test5.in deleted file mode 100644 index e19e20d59b..0000000000 --- a/src/nvim/testdir/test5.in +++ /dev/null @@ -1,29 +0,0 @@ -Test for autocommand that deletes the current buffer on BufLeave event. -Also test deleting the last buffer, should give a new, empty buffer. - -STARTTEST -:so small.vim -:au BufLeave Xxx bwipe -/start of -:.,/end of/w! Xxx " write test file Xxx -:sp Xxx " split to Xxx -:bwipe " delete buffer Xxx, now we're back here -G?this is a -othis is some more text -: " Append some text to this file -:?start?,$w! test.out " Write current file contents -:bwipe test.out " delete alternate buffer -:au bufleave test5.in bwipe -:bwipe! " delete current buffer, get an empty one -ithis is another test line:w >>test.out -: " append an extra line to the output file -:qa! -ENDTEST - -start of test file Xxx -vim: set noai : - this is a test - this is a test - this is a test - this is a test -end of test file Xxx diff --git a/src/nvim/testdir/test5.ok b/src/nvim/testdir/test5.ok deleted file mode 100644 index 6743060794..0000000000 --- a/src/nvim/testdir/test5.ok +++ /dev/null @@ -1,9 +0,0 @@ -start of test file Xxx -vim: set noai : - this is a test - this is a test - this is a test - this is a test -this is some more text -end of test file Xxx -this is another test line diff --git a/test/functional/legacy/005_bufleave_delete_buffer.lua b/test/functional/legacy/005_bufleave_delete_buffer.lua new file mode 100644 index 0000000000..e8459ad4a7 --- /dev/null +++ b/test/functional/legacy/005_bufleave_delete_buffer.lua @@ -0,0 +1,71 @@ +-- Test for autocommand that deletes the current buffer on BufLeave event. +-- Also test deleting the last buffer, should give a new, empty buffer. + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('test5', function() + setup(clear) + + it('is working', function() + insert([[ + start of test file Xxx + vim: set noai : + this is a test + this is a test + this is a test + this is a test + end of test file Xxx]]) + + execute('w! Xxx0') + execute('au BufLeave Xxx bwipe') + execute('/start of') + + -- Write test file Xxx. + execute('.,/end of/w! Xxx') + + -- Split to Xxx. + execute('sp Xxx') + + -- Delete buffer Xxx, now we're back here. + execute('bwipe') + feed('G?this is a') + feed('othis is some more text') + + -- Append some text to this file. + + -- Write current file contents. + execute('?start?,$yank A') + + -- Delete alternate buffer. + execute('bwipe test.out') + execute('au bufleave test5.in bwipe') + + -- Delete current buffer, get an empty one. + execute('bwipe!') + feed('ithis is another test line:yank A') + + -- Output results + execute('%d') + execute('0put a') + execute('1d | $d') + + -- Assert buffer contents. + expect([[ + start of test file Xxx + vim: set noai : + this is a test + this is a test + this is a test + this is a test + this is some more text + end of test file Xxx + this is another test line]]) + end) + + teardown(function() + os.remove('Xxx') + os.remove('Xxx0') + end) +end) From 1732615290573d98e8e0221a2f8d600d44c14d10 Mon Sep 17 00:00:00 2001 From: Rainer Borene Date: Thu, 6 Nov 2014 21:30:37 -0200 Subject: [PATCH 02/14] legacy tests: remove test21 files --- src/nvim/testdir/test21.in | 19 ------------------- src/nvim/testdir/test21.ok | 2 -- 2 files changed, 21 deletions(-) delete mode 100644 src/nvim/testdir/test21.in delete mode 100644 src/nvim/testdir/test21.ok diff --git a/src/nvim/testdir/test21.in b/src/nvim/testdir/test21.in deleted file mode 100644 index 491b9f7404..0000000000 --- a/src/nvim/testdir/test21.in +++ /dev/null @@ -1,19 +0,0 @@ -Tests for [ CTRL-I with a count and CTRL-W CTRL-I with a count - -STARTTEST -:so small.vim -/start -6[ :.w! test.out -?start here -6 :.w >>test.out -:qa! -ENDTEST - -#include test21.in - -/* test text test tex start here - some text - test text - start OK if found this line - start found wrong line -test text diff --git a/src/nvim/testdir/test21.ok b/src/nvim/testdir/test21.ok deleted file mode 100644 index d9f1b759ce..0000000000 --- a/src/nvim/testdir/test21.ok +++ /dev/null @@ -1,2 +0,0 @@ - start OK if found this line - start OK if found this line From e0332e7f7c058baa2c25a495db332d2d028dd041 Mon Sep 17 00:00:00 2001 From: Rainer Borene Date: Tue, 11 Nov 2014 07:12:19 -0200 Subject: [PATCH 03/14] legacy tests: implement :source helper method. --- test/functional/helpers.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 6c3f5190c9..2c08fb7818 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -182,6 +182,16 @@ local function execute(...) end end +local function source(code) + local tmpname = os.tmpname() + local tmpfile = io.open(tmpname, "w") + tmpfile:write(code) + tmpfile:flush() + tmpfile:close() + nvim_command('source '..tmpname) + os.remove(tmpname) +end + local function eq(expected, actual) return assert.are.same(expected, actual) end @@ -247,6 +257,7 @@ clear() return { clear = clear, dedent = dedent, + source = source, rawfeed = rawfeed, insert = insert, feed = feed, From 8ca8a0da08bbf8f1670490b4c1cf1b39668816b6 Mon Sep 17 00:00:00 2001 From: Rainer Borene Date: Thu, 6 Nov 2014 21:40:50 -0200 Subject: [PATCH 04/14] legacy tests: migrate test104 --- src/nvim/testdir/test104.in | 30 ----------- src/nvim/testdir/test104.ok | 13 ----- .../functional/fixtures}/autoload/Test104.vim | 0 test/functional/legacy/104_let_assignment.lua | 54 +++++++++++++++++++ 4 files changed, 54 insertions(+), 43 deletions(-) delete mode 100644 src/nvim/testdir/test104.in delete mode 100644 src/nvim/testdir/test104.ok rename {src/nvim/testdir/sautest => test/functional/fixtures}/autoload/Test104.vim (100%) create mode 100644 test/functional/legacy/104_let_assignment.lua diff --git a/src/nvim/testdir/test104.in b/src/nvim/testdir/test104.in deleted file mode 100644 index fd847131e9..0000000000 --- a/src/nvim/testdir/test104.in +++ /dev/null @@ -1,30 +0,0 @@ -Tests for :let. vim: set ft=vim ts=8 : - -STARTTEST -:so small.vim -:set runtimepath+=./sautest -:" Test to not autoload when assigning. It causes internal error. -:try -: let Test104#numvar = function('tr') -: $put ='OK: ' . string(Test104#numvar) -:catch -: $put ='FAIL: ' . v:exception -:endtry -:let a = 1 -:let b = 2 -:for letargs in ['a b', '{0 == 1 ? "a" : "b"}', '{0 == 1 ? "a" : "b"} a', 'a {0 == 1 ? "a" : "b"}'] -: try -: redir => messages -: execute 'let' letargs -: redir END -: $put ='OK:' -: $put =split(substitute(messages, '\n', '\0 ', 'g'), '\n') -: catch -: $put ='FAIL: ' . v:exception -: redir END -: endtry -:endfor -:/^Results/,$wq! test.out -ENDTEST - -Results of test104: diff --git a/src/nvim/testdir/test104.ok b/src/nvim/testdir/test104.ok deleted file mode 100644 index 5fb20945c3..0000000000 --- a/src/nvim/testdir/test104.ok +++ /dev/null @@ -1,13 +0,0 @@ -Results of test104: -OK: function('tr') -OK: - a #1 - b #2 -OK: - b #2 -OK: - b #2 - a #1 -OK: - a #1 - b #2 diff --git a/src/nvim/testdir/sautest/autoload/Test104.vim b/test/functional/fixtures/autoload/Test104.vim similarity index 100% rename from src/nvim/testdir/sautest/autoload/Test104.vim rename to test/functional/fixtures/autoload/Test104.vim diff --git a/test/functional/legacy/104_let_assignment.lua b/test/functional/legacy/104_let_assignment.lua new file mode 100644 index 0000000000..a2431da835 --- /dev/null +++ b/test/functional/legacy/104_let_assignment.lua @@ -0,0 +1,54 @@ +-- Tests for :let. + +local helpers = require('test.functional.helpers') +local clear, source = helpers.clear, helpers.source +local execute, expect = helpers.execute, helpers.expect + +describe(':let', function() + setup(clear) + + it('is working', function() + execute('set runtimepath+=test/functional/fixtures') + + -- Test to not autoload when assigning. It causes internal error. + source([[ + try + let Test104#numvar = function('tr') + $put ='OK: ' . string(Test104#numvar) + catch + $put ='FAIL: ' . v:exception + endtry + let a = 1 + let b = 2 + for letargs in ['a b', '{0 == 1 ? "a" : "b"}', '{0 == 1 ? "a" : "b"} a', 'a {0 == 1 ? "a" : "b"}'] + try + redir => messages + execute 'let' letargs + redir END + $put ='OK:' + $put =split(substitute(messages, '\n', '\0 ', 'g'), '\n') + catch + $put ='FAIL: ' . v:exception + redir END + endtry + endfor]]) + + -- Remove empty line + execute('1d') + + -- Assert buffer contents. + expect([[ + OK: function('tr') + OK: + a #1 + b #2 + OK: + b #2 + OK: + b #2 + a #1 + OK: + a #1 + b #2]]) + end) +end) From 963a146e8bc09bfb3ef0b8c16e4361b2f57fe0fb Mon Sep 17 00:00:00 2001 From: Rainer Borene Date: Sat, 8 Nov 2014 16:02:49 -0200 Subject: [PATCH 05/14] legacy tests: migrate test25 --- src/nvim/testdir/test25.in | 31 ------------ src/nvim/testdir/test25.ok | 1 - .../legacy/025_jump_tag_hidden_spec.lua | 50 +++++++++++++++++++ 3 files changed, 50 insertions(+), 32 deletions(-) delete mode 100644 src/nvim/testdir/test25.in delete mode 100644 src/nvim/testdir/test25.ok create mode 100644 test/functional/legacy/025_jump_tag_hidden_spec.lua diff --git a/src/nvim/testdir/test25.in b/src/nvim/testdir/test25.in deleted file mode 100644 index 4139865daf..0000000000 --- a/src/nvim/testdir/test25.in +++ /dev/null @@ -1,31 +0,0 @@ -Test for jumping to a tag with 'hidden' set, with symbolic link in path of tag. -This only works for Unix, because of the symbolic link. - -STARTTEST -:so small.vim -:set hidden -:" Create a link from test25.dir to the current directory. -:!rm -f test25.dir -:!ln -s . test25.dir -:" Create tags.text, with the current directory name inserted. -/tags line -:r !pwd -d$/test -hP:.w! tags.test -:" Try jumping to a tag in the current file, but with a path that contains a -:" symbolic link. When wrong, this will give the ATTENTION message. The next -:" space will then be eaten by hit-return, instead of moving the cursor to 'd'. -:set tags=tags.test -G x:.w! test.out -:!rm -f test25.dir tags.test -:qa! -ENDTEST - -tags line: -SECTION_OFF /test25.dir/test25.in /^#define SECTION_OFF 3$/ - -/*tx.c*/ -#define SECTION_OFF 3 -#define NUM_SECTIONS 3 - -SECTION_OFF diff --git a/src/nvim/testdir/test25.ok b/src/nvim/testdir/test25.ok deleted file mode 100644 index 08fc070b7b..0000000000 --- a/src/nvim/testdir/test25.ok +++ /dev/null @@ -1 +0,0 @@ -#efine SECTION_OFF 3 diff --git a/test/functional/legacy/025_jump_tag_hidden_spec.lua b/test/functional/legacy/025_jump_tag_hidden_spec.lua new file mode 100644 index 0000000000..bd434c013c --- /dev/null +++ b/test/functional/legacy/025_jump_tag_hidden_spec.lua @@ -0,0 +1,50 @@ +-- Test for jumping to a tag with 'hidden' set, with symbolic link in path of tag. +-- This only works for Unix, because of the symbolic link. + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('jump to a tag with hidden set', function() + setup(clear) + + it('is working', function() + insert([[ + tags line: + SECTION_OFF /test25.dir/Xxx /^#define SECTION_OFF 3$/ + + /*tx.c*/ + #define SECTION_OFF 3 + #define NUM_SECTIONS 3 + + SECTION_OFF]]) + + execute('w! Xxx') + execute('set hidden') + + -- Create a link from test25.dir to the current directory. + execute('!rm -f test25.dir') + execute('!ln -s . test25.dir') + + -- Create tags.text, with the current directory name inserted. + execute('/tags line') + execute('r !pwd') + feed('d$/test') + feed('hP:.w! tags.test') + + -- Try jumping to a tag in the current file, but with a path that contains a + -- symbolic link. When wrong, this will give the ATTENTION message. The next + -- space will then be eaten by hit-return, instead of moving the cursor to 'd'. + execute('set tags=tags.test') + feed('G x:yank a') + execute('!rm -f Xxx test25.dir tags.test') + + -- Put @a and remove empty line + execute('%d') + execute('0put a') + execute('$d') + + -- Assert buffer contents. + expect("#efine SECTION_OFF 3") + end) +end) From 7fc5d6fc8e9bc4f03c2adeea04a6d3c0c2cdc9a3 Mon Sep 17 00:00:00 2001 From: Rainer Borene Date: Sat, 8 Nov 2014 17:08:42 -0200 Subject: [PATCH 06/14] legacy tests: migrate test66 --- src/nvim/testdir/test66.in | 33 ---------- src/nvim/testdir/test66.ok | 16 ----- .../legacy/066_visual_block_tab_spec.lua | 64 +++++++++++++++++++ 3 files changed, 64 insertions(+), 49 deletions(-) delete mode 100644 src/nvim/testdir/test66.in delete mode 100644 src/nvim/testdir/test66.ok create mode 100644 test/functional/legacy/066_visual_block_tab_spec.lua diff --git a/src/nvim/testdir/test66.in b/src/nvim/testdir/test66.in deleted file mode 100644 index f1fdce3792..0000000000 --- a/src/nvim/testdir/test66.in +++ /dev/null @@ -1,33 +0,0 @@ - -Test for visual block shift and tab characters. - -STARTTEST -:so small.vim -/^one -fe4jRugvr1:'<,'>w! test.out -/^abcdefgh -4jI j<<11|D -7|a  -7|a  -7|a 4k13|4j< -:$-5,$w >> test.out -:$-4,$s/\s\+//g -4kI j<< -7|a  -7|a  -7|a 4k13|4j3< -:$-4,$w >> test.out -:qa! -ENDTEST - -one two three -one two three -one two three -one two three -one two three - -abcdefghijklmnopqrstuvwxyz -abcdefghijklmnopqrstuvwxyz -abcdefghijklmnopqrstuvwxyz -abcdefghijklmnopqrstuvwxyz -abcdefghijklmnopqrstuvwxyz diff --git a/src/nvim/testdir/test66.ok b/src/nvim/testdir/test66.ok deleted file mode 100644 index 4c3ab0fb56..0000000000 --- a/src/nvim/testdir/test66.ok +++ /dev/null @@ -1,16 +0,0 @@ -on1 two three -on1 two three -on1 two three -on1 two three -on1 two three - - abcdefghijklmnopqrstuvwxyz -abcdefghij - abc defghijklmnopqrstuvwxyz - abc defghijklmnopqrstuvwxyz - abc defghijklmnopqrstuvwxyz - abcdefghijklmnopqrstuvwxyz -abcdefghij - abc defghijklmnopqrstuvwxyz - abc defghijklmnopqrstuvwxyz - abc defghijklmnopqrstuvwxyz diff --git a/test/functional/legacy/066_visual_block_tab_spec.lua b/test/functional/legacy/066_visual_block_tab_spec.lua new file mode 100644 index 0000000000..cd283e6746 --- /dev/null +++ b/test/functional/legacy/066_visual_block_tab_spec.lua @@ -0,0 +1,64 @@ +-- vim: set foldmethod=marker foldmarker=[[,]] : +-- Test for visual block shift and tab characters. + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('visual block shift and tab characters', function() + setup(clear) + + it('is working', function() + insert([[ + one two three + one two three + one two three + one two three + one two three + + abcdefghijklmnopqrstuvwxyz + abcdefghijklmnopqrstuvwxyz + abcdefghijklmnopqrstuvwxyz + abcdefghijklmnopqrstuvwxyz + abcdefghijklmnopqrstuvwxyz]]) + + feed('gg') + feed([[fe4jRugvr1:'<,'>yank A]]) + execute('/^abcdefgh') + feed('4jI j<<11|D') + feed('j7|a ') + feed('j7|a ') + feed('j7|a 4k13|4j<') + execute('$-5,$yank A') + execute([[$-4,$s/\s\+//g]]) + feed('4kI j<<') + feed('j7|a ') + feed('j7|a ') + feed('j7|a 4k13|4j3<') + execute('$-4,$yank A') + + -- Put @a and clean empty lines + execute('%d') + execute('0put a') + execute('$d') + + -- Assert buffer contents. + expect([[ + on1 two three + on1 two three + on1 two three + on1 two three + on1 two three + + abcdefghijklmnopqrstuvwxyz + abcdefghij + abc defghijklmnopqrstuvwxyz + abc defghijklmnopqrstuvwxyz + abc defghijklmnopqrstuvwxyz + abcdefghijklmnopqrstuvwxyz + abcdefghij + abc defghijklmnopqrstuvwxyz + abc defghijklmnopqrstuvwxyz + abc defghijklmnopqrstuvwxyz]]) + end) +end) From 8c872a945e3f29b45a19ba7184ca99f88907fe89 Mon Sep 17 00:00:00 2001 From: Rainer Borene Date: Sat, 8 Nov 2014 18:17:04 -0200 Subject: [PATCH 07/14] legacy tests: migrate test67 --- src/nvim/testdir/test67.in | 33 ------------- src/nvim/testdir/test67.ok | 10 ---- .../legacy/067_augroup_exists_spec.lua | 46 +++++++++++++++++++ 3 files changed, 46 insertions(+), 43 deletions(-) delete mode 100644 src/nvim/testdir/test67.in delete mode 100644 src/nvim/testdir/test67.ok create mode 100644 test/functional/legacy/067_augroup_exists_spec.lua diff --git a/src/nvim/testdir/test67.in b/src/nvim/testdir/test67.in deleted file mode 100644 index 08b4e3701f..0000000000 --- a/src/nvim/testdir/test67.in +++ /dev/null @@ -1,33 +0,0 @@ -Test that groups and patterns are tested correctly when calling exists() for -autocommands. - -STARTTEST -:so small.vim -:let results=[] -:augroup auexists -:augroup END -:call add(results, "##BufEnter: " . exists("##BufEnter")) -:call add(results, "#BufEnter: " . exists("#BufEnter")) -:au BufEnter * let g:entered=1 -:call add(results, "#BufEnter: " . exists("#BufEnter")) -:call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter")) -:augroup auexists -:au BufEnter * let g:entered=1 -:augroup END -:call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter")) -:call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test")) -:au BufEnter *.test let g:entered=1 -:call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test")) -:edit testfile.test -:call add(results, "#BufEnter#: " . exists("#BufEnter#")) -:au BufEnter let g:entered=1 -:call add(results, "#BufEnter#: " . exists("#BufEnter#")) -:edit testfile2.test -:call add(results, "#BufEnter#: " . exists("#BufEnter#")) -:e test.out -:call append(0, results) -:$d -:w -:qa! -ENDTEST - diff --git a/src/nvim/testdir/test67.ok b/src/nvim/testdir/test67.ok deleted file mode 100644 index 51188e5afd..0000000000 --- a/src/nvim/testdir/test67.ok +++ /dev/null @@ -1,10 +0,0 @@ -##BufEnter: 1 -#BufEnter: 0 -#BufEnter: 1 -#auexists#BufEnter: 0 -#auexists#BufEnter: 1 -#BufEnter#*.test: 0 -#BufEnter#*.test: 1 -#BufEnter#: 0 -#BufEnter#: 1 -#BufEnter#: 0 diff --git a/test/functional/legacy/067_augroup_exists_spec.lua b/test/functional/legacy/067_augroup_exists_spec.lua new file mode 100644 index 0000000000..6d89ad6d55 --- /dev/null +++ b/test/functional/legacy/067_augroup_exists_spec.lua @@ -0,0 +1,46 @@ +-- Test that groups and patterns are tested correctly when calling exists() for +-- autocommands. + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('augroup when calling exists()', function() + setup(clear) + + it('is working', function() + execute('let results=[]') + execute('call add(results, "##BufEnter: " . exists("##BufEnter"))') + execute('call add(results, "#BufEnter: " . exists("#BufEnter"))') + execute('au BufEnter * let g:entered=1') + execute('call add(results, "#BufEnter: " . exists("#BufEnter"))') + execute('call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter"))') + execute('augroup auexists', 'au BufEnter * let g:entered=1', 'augroup END') + execute('call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter"))') + execute('call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test"))') + execute('au BufEnter *.test let g:entered=1') + execute('call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test"))') + execute('edit testfile.test') + execute('call add(results, "#BufEnter#: " . exists("#BufEnter#"))') + execute('au BufEnter let g:entered=1') + execute('call add(results, "#BufEnter#: " . exists("#BufEnter#"))') + execute('edit testfile2.test') + execute('call add(results, "#BufEnter#: " . exists("#BufEnter#"))') + execute('bf') + execute('call append(0, results)') + execute('$d') + + -- Assert buffer contents. + expect([[ + ##BufEnter: 1 + #BufEnter: 0 + #BufEnter: 1 + #auexists#BufEnter: 0 + #auexists#BufEnter: 1 + #BufEnter#*.test: 0 + #BufEnter#*.test: 1 + #BufEnter#: 0 + #BufEnter#: 1 + #BufEnter#: 0]]) + end) +end) From bbd95c051426f1b3b8a200c3aaf44af1d3b01ef1 Mon Sep 17 00:00:00 2001 From: Rainer Borene Date: Sun, 9 Nov 2014 18:26:14 -0200 Subject: [PATCH 08/14] legacy tests: migrate test33 --- src/nvim/testdir/test33.in | 34 --------- src/nvim/testdir/test33.ok | 23 ------ .../legacy/033_lisp_indent_spec.lua | 73 +++++++++++++++++++ 3 files changed, 73 insertions(+), 57 deletions(-) delete mode 100644 src/nvim/testdir/test33.in delete mode 100644 src/nvim/testdir/test33.ok create mode 100644 test/functional/legacy/033_lisp_indent_spec.lua diff --git a/src/nvim/testdir/test33.in b/src/nvim/testdir/test33.in deleted file mode 100644 index 5644760402..0000000000 --- a/src/nvim/testdir/test33.in +++ /dev/null @@ -1,34 +0,0 @@ -Test for 'lisp' -If the lisp feature is not enabled, this will fail! - -STARTTEST -:so small.vim -:set lisp -/^(defun -=G:/^(defun/,$w! test.out -:q! -ENDTEST - -(defun html-file (base) -(format nil "~(~A~).html" base)) - -(defmacro page (name title &rest body) -(let ((ti (gensym))) -`(with-open-file (*standard-output* -(html-file ,name) -:direction :output -:if-exists :supersede) -(let ((,ti ,title)) -(as title ,ti) -(with center -(as h2 (string-upcase ,ti))) -(brs 3) -,@body)))) - -;;; Utilities for generating links - -(defmacro with-link (dest &rest body) -`(progn -(format t "" (html-file ,dest)) -,@body -(princ ""))) diff --git a/src/nvim/testdir/test33.ok b/src/nvim/testdir/test33.ok deleted file mode 100644 index cd1d87a14b..0000000000 --- a/src/nvim/testdir/test33.ok +++ /dev/null @@ -1,23 +0,0 @@ -(defun html-file (base) - (format nil "~(~A~).html" base)) - -(defmacro page (name title &rest body) - (let ((ti (gensym))) - `(with-open-file (*standard-output* - (html-file ,name) - :direction :output - :if-exists :supersede) - (let ((,ti ,title)) - (as title ,ti) - (with center - (as h2 (string-upcase ,ti))) - (brs 3) - ,@body)))) - -;;; Utilities for generating links - -(defmacro with-link (dest &rest body) - `(progn - (format t "" (html-file ,dest)) - ,@body - (princ ""))) diff --git a/test/functional/legacy/033_lisp_indent_spec.lua b/test/functional/legacy/033_lisp_indent_spec.lua new file mode 100644 index 0000000000..3ee248815d --- /dev/null +++ b/test/functional/legacy/033_lisp_indent_spec.lua @@ -0,0 +1,73 @@ +-- vim: set foldmethod=marker foldmarker=[[,]] : +-- Test for 'lisp' +-- If the lisp feature is not enabled, this will fail! + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('lisp indent', function() + setup(clear) + + it('is working', function() + insert([[ + (defun html-file (base) + (format nil "~(~A~).html" base)) + + (defmacro page (name title &rest body) + (let ((ti (gensym))) + `(with-open-file (*standard-output* + (html-file ,name) + :direction :output + :if-exists :supersede) + (let ((,ti ,title)) + (as title ,ti) + (with center + (as h2 (string-upcase ,ti))) + (brs 3) + ,@body)))) + + ;;; Utilities for generating links + + (defmacro with-link (dest &rest body) + `(progn + (format t "" (html-file ,dest)) + ,@body + (princ "")))]]) + + execute('set lisp expandtab') + execute('/^(defun') + feed('=G:/^(defun/,$yank A') + + -- Put @a and clean empty line + execute('%d') + execute('0put a') + execute('$d') + + -- Assert buffer contents. + expect([[ + (defun html-file (base) + (format nil "~(~A~).html" base)) + + (defmacro page (name title &rest body) + (let ((ti (gensym))) + `(with-open-file (*standard-output* + (html-file ,name) + :direction :output + :if-exists :supersede) + (let ((,ti ,title)) + (as title ,ti) + (with center + (as h2 (string-upcase ,ti))) + (brs 3) + ,@body)))) + + ;;; Utilities for generating links + + (defmacro with-link (dest &rest body) + `(progn + (format t "" (html-file ,dest)) + ,@body + (princ "")))]]) + end) +end) From c9159586b87168c0725524165f33607ebb83efd7 Mon Sep 17 00:00:00 2001 From: Rainer Borene Date: Sun, 9 Nov 2014 18:31:22 -0200 Subject: [PATCH 09/14] legacy tests: migrate test43 --- src/nvim/testdir/test43.in | 34 ----------- src/nvim/testdir/test43.ok | 11 ---- .../legacy/043_magic_settings_spec.lua | 61 +++++++++++++++++++ 3 files changed, 61 insertions(+), 45 deletions(-) delete mode 100644 src/nvim/testdir/test43.in delete mode 100644 src/nvim/testdir/test43.ok create mode 100644 test/functional/legacy/043_magic_settings_spec.lua diff --git a/src/nvim/testdir/test43.in b/src/nvim/testdir/test43.in deleted file mode 100644 index 7c545073da..0000000000 --- a/src/nvim/testdir/test43.in +++ /dev/null @@ -1,34 +0,0 @@ -Tests for regexp with various magic settings. - -STARTTEST -:so small.vim -:set nocompatible viminfo+=nviminfo -/^1 -/a*b\{2}c\+/e -x/\Md\*e\{2}f\+/e -x:set nomagic -/g\*h\{2}i\+/e -x/\mj*k\{2}l\+/e -x/\vm*n{2}o+/e -x/\V^aa$ -x:set magic -/\v(a)(b)\2\1\1/e -x/\V[ab]\(\[xy]\)\1 -x:$ -:set undolevels=100 -dv?bar? -Yup:" -:?^1?,$w! test.out -:qa! -ENDTEST - -1 a aa abb abbccc -2 d dd dee deefff -3 g gg ghh ghhiii -4 j jj jkk jkklll -5 m mm mnn mnnooo -6 x ^aa$ x -7 (a)(b) abbaa -8 axx [ab]xx -9 foobar - diff --git a/src/nvim/testdir/test43.ok b/src/nvim/testdir/test43.ok deleted file mode 100644 index 0b37a6a61e..0000000000 --- a/src/nvim/testdir/test43.ok +++ /dev/null @@ -1,11 +0,0 @@ -1 a aa abb abbcc -2 d dd dee deeff -3 g gg ghh ghhii -4 j jj jkk jkkll -5 m mm mnn mnnoo -6 x aa$ x -7 (a)(b) abba -8 axx ab]xx -9 foobar -9 foo - diff --git a/test/functional/legacy/043_magic_settings_spec.lua b/test/functional/legacy/043_magic_settings_spec.lua new file mode 100644 index 0000000000..ccef298cdd --- /dev/null +++ b/test/functional/legacy/043_magic_settings_spec.lua @@ -0,0 +1,61 @@ +-- vim: set foldmethod=marker foldmarker=[[,]] : +-- Tests for regexp with various magic settings. + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe('regexp with magic settings', function() + setup(clear) + + it('is working', function() + insert([[ + 1 a aa abb abbccc + 2 d dd dee deefff + 3 g gg ghh ghhiii + 4 j jj jkk jkklll + 5 m mm mnn mnnooo + 6 x ^aa$ x + 7 (a)(b) abbaa + 8 axx [ab]xx + 9 foobar + ]]) + + execute('set nocompatible viminfo+=nviminfo') + execute('/^1') + execute([[/a*b\{2}c\+/e]]) + feed([[x/\Md\*e\{2}f\+/e]]) + feed('x:set nomagic') + execute([[/g\*h\{2}i\+/e]]) + feed([[x/\mj*k\{2}l\+/e]]) + feed([[x/\vm*n{2}o+/e]]) + feed([[x/\V^aa$]]) + feed('x:set magic') + execute([[/\v(a)(b)\2\1\1/e]]) + feed([[x/\V[ab]\(\[xy]\)\1]]) + feed('x:$') + execute('set undolevels=100') + feed('dv?bar?') + feed('Yup:') + execute('?^1?,$yank A') + + -- Put @a and clean empty line + execute('%d') + execute('0put a') + execute('$d') + + -- Assert buffer contents. + expect([[ + 1 a aa abb abbcc + 2 d dd dee deeff + 3 g gg ghh ghhii + 4 j jj jkk jkkll + 5 m mm mnn mnnoo + 6 x aa$ x + 7 (a)(b) abba + 8 axx ab]xx + 9 foobar + 9 foo + ]]) + end) +end) From a93d370c75da5fbdd04176bf881a95833989ea02 Mon Sep 17 00:00:00 2001 From: Rainer Borene Date: Sun, 9 Nov 2014 18:54:33 -0200 Subject: [PATCH 10/14] legacy tests: migrate test51 --- src/nvim/testdir/test51.in | 36 ---------- src/nvim/testdir/test51.ok | 20 ------ test/functional/legacy/051_highlight_spec.lua | 70 +++++++++++++++++++ 3 files changed, 70 insertions(+), 56 deletions(-) delete mode 100644 src/nvim/testdir/test51.in delete mode 100644 src/nvim/testdir/test51.ok create mode 100644 test/functional/legacy/051_highlight_spec.lua diff --git a/src/nvim/testdir/test51.in b/src/nvim/testdir/test51.in deleted file mode 100644 index b4f45d1f75..0000000000 --- a/src/nvim/testdir/test51.in +++ /dev/null @@ -1,36 +0,0 @@ -Tests for ":highlight". vim: set ft=vim : - -STARTTEST -:so small.vim -:" basic test if ":highlight" doesn't crash -:highlight -:hi Search -:" test setting colors. -:" test clearing one color and all doesn't generate error or warning -:hi NewGroup term=bold cterm=italic ctermfg=DarkBlue ctermbg=Grey gui= guifg=#00ff00 guibg=Cyan -:hi Group2 term= cterm= -:hi Group3 term=underline cterm=bold -:redir! >test.out -:hi NewGroup -:hi Group2 -:hi Group3 -:hi clear NewGroup -:hi NewGroup -:hi Group2 -:hi Group2 NONE -:hi Group2 -:hi clear -:hi Group3 -:hi Crash term='asdf -:redir END -:" filter ctermfg and ctermbg, the numbers depend on the terminal -:e test.out -:%s/ctermfg=\d*/ctermfg=2/ -:%s/ctermbg=\d*/ctermbg=3/ -:" filter out possibly translated error message -:%s/E475: [^:]*:/E475:/ -:" fix the fileformat -:set ff& -:wq! -ENDTEST - diff --git a/src/nvim/testdir/test51.ok b/src/nvim/testdir/test51.ok deleted file mode 100644 index be9ff7862c..0000000000 --- a/src/nvim/testdir/test51.ok +++ /dev/null @@ -1,20 +0,0 @@ - - -NewGroup xxx term=bold cterm=italic ctermfg=2 ctermbg=3 - -Group2 xxx cleared - -Group3 xxx term=underline cterm=bold - - -NewGroup xxx cleared - -Group2 xxx cleared - - -Group2 xxx cleared - - -Group3 xxx cleared - -E475: term='asdf diff --git a/test/functional/legacy/051_highlight_spec.lua b/test/functional/legacy/051_highlight_spec.lua new file mode 100644 index 0000000000..f35b70f93f --- /dev/null +++ b/test/functional/legacy/051_highlight_spec.lua @@ -0,0 +1,70 @@ +-- vim: set foldmethod=marker foldmarker=[[,]] : +-- Tests for ":highlight". + +local helpers = require('test.functional.helpers') +local clear, feed, insert = helpers.clear, helpers.feed, helpers.insert +local execute, expect = helpers.execute, helpers.expect + +describe(':highlight', function() + setup(clear) + + it('is working', function() + -- Basic test if ":highlight" doesn't crash + execute('highlight') + execute('hi Search') + + -- Test setting colors. + -- Test clearing one color and all doesn't generate error or warning + execute('hi NewGroup term=bold cterm=italic ctermfg=DarkBlue ctermbg=Grey gui= guifg=#00ff00 guibg=Cyan') + execute('hi Group2 term= cterm=') + execute('hi Group3 term=underline cterm=bold') + execute('redir! @a') + execute('hi NewGroup') + execute('hi Group2') + execute('hi Group3') + execute('hi clear NewGroup') + execute('hi NewGroup') + execute('hi Group2') + execute('hi Group2 NONE') + execute('hi Group2') + execute('hi clear') + execute('hi Group3') + execute([[hi Crash term='asdf]]) + execute('redir END') + + -- Filter ctermfg and ctermbg, the numbers depend on the terminal + execute('0put a') + execute([[%s/ctermfg=\d*/ctermfg=2/]]) + execute([[%s/ctermbg=\d*/ctermbg=3/]]) + + -- Filter out possibly translated error message + execute('%s/E475: [^:]*:/E475:/') + + -- Fix the fileformat + execute('set ff&') + execute('$d') + + -- Assert buffer contents. + expect([[ + + + NewGroup xxx term=bold cterm=italic ctermfg=2 ctermbg=3 + + Group2 xxx cleared + + Group3 xxx term=underline cterm=bold + + + NewGroup xxx cleared + + Group2 xxx cleared + + + Group2 xxx cleared + + + Group3 xxx cleared + + E475: term='asdf]]) + end) +end) From 50876c2f7095d0a43dd33d2ed3cfd773e33ce882 Mon Sep 17 00:00:00 2001 From: Rainer Borene Date: Sun, 9 Nov 2014 20:42:45 -0200 Subject: [PATCH 11/14] legacy tests: migrate test75 --- src/nvim/testdir/test75.in | 41 --------------- src/nvim/testdir/test75.ok | 7 --- test/functional/legacy/075_maparg_spec.lua | 58 ++++++++++++++++++++++ 3 files changed, 58 insertions(+), 48 deletions(-) delete mode 100644 src/nvim/testdir/test75.in delete mode 100644 src/nvim/testdir/test75.ok create mode 100644 test/functional/legacy/075_maparg_spec.lua diff --git a/src/nvim/testdir/test75.in b/src/nvim/testdir/test75.in deleted file mode 100644 index 8fabccdf52..0000000000 --- a/src/nvim/testdir/test75.in +++ /dev/null @@ -1,41 +0,0 @@ -Tests for maparg(). -Also test utf8 map with a 0x80 byte. - -STARTTEST -:so small.vim -:so mbyte.vim -:set cpo-=< -:set encoding=utf8 -:" Test maparg() with a string result -:map foo isfoo -:vnoremap