From 66f89ae3210c00db11a9b26fc57c1791f362a53d Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Fri, 15 May 2015 19:03:49 +0200 Subject: [PATCH 1/2] tests: Migrate legacy test 83. --- src/nvim/testdir/Makefile | 1 - src/nvim/testdir/test83-tags2 | 2 - src/nvim/testdir/test83-tags3 | 102 --------- src/nvim/testdir/test83.in | 75 ------- src/nvim/testdir/test83.ok | 4 - ...083_tag_search_with_file_encoding_spec.lua | 209 ++++++++++++++++++ 6 files changed, 209 insertions(+), 184 deletions(-) delete mode 100644 src/nvim/testdir/test83-tags2 delete mode 100644 src/nvim/testdir/test83-tags3 delete mode 100644 src/nvim/testdir/test83.in delete mode 100644 src/nvim/testdir/test83.ok create mode 100644 test/functional/legacy/083_tag_search_with_file_encoding_spec.lua diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile index aaa6f4b97e..e27ac227c8 100644 --- a/src/nvim/testdir/Makefile +++ b/src/nvim/testdir/Makefile @@ -22,7 +22,6 @@ SCRIPTS := test_eval.out \ test68.out test69.out \ test73.out \ test79.out \ - test83.out \ test88.out \ test_listlbr.out \ test_breakindent.out \ diff --git a/src/nvim/testdir/test83-tags2 b/src/nvim/testdir/test83-tags2 deleted file mode 100644 index 7f9f21b0eb..0000000000 --- a/src/nvim/testdir/test83-tags2 +++ /dev/null @@ -1,2 +0,0 @@ -!_TAG_FILE_ENCODING cp932 // -‚`‚a‚b Xtags2.txt /‚`‚a‚b diff --git a/src/nvim/testdir/test83-tags3 b/src/nvim/testdir/test83-tags3 deleted file mode 100644 index 0cb6591562..0000000000 --- a/src/nvim/testdir/test83-tags3 +++ /dev/null @@ -1,102 +0,0 @@ -!_TAG_FILE_SORTED 1 // -!_TAG_FILE_ENCODING cp932 // -abc1 Xtags3.txt /‚`‚a‚b -abc2 Xtags3.txt /‚`‚a‚b -abc3 Xtags3.txt /‚`‚a‚b -abc4 Xtags3.txt /‚`‚a‚b -abc5 Xtags3.txt /‚`‚a‚b -abc6 Xtags3.txt /‚`‚a‚b -abc7 Xtags3.txt /‚`‚a‚b -abc8 Xtags3.txt /‚`‚a‚b -abc9 Xtags3.txt /‚`‚a‚b -abc10 Xtags3.txt /‚`‚a‚b -abc11 Xtags3.txt /‚`‚a‚b -abc12 Xtags3.txt /‚`‚a‚b -abc13 Xtags3.txt /‚`‚a‚b -abc14 Xtags3.txt /‚`‚a‚b -abc15 Xtags3.txt /‚`‚a‚b -abc16 Xtags3.txt /‚`‚a‚b -abc17 Xtags3.txt /‚`‚a‚b -abc18 Xtags3.txt /‚`‚a‚b -abc19 Xtags3.txt /‚`‚a‚b -abc20 Xtags3.txt /‚`‚a‚b -abc21 Xtags3.txt /‚`‚a‚b -abc22 Xtags3.txt /‚`‚a‚b -abc23 Xtags3.txt /‚`‚a‚b -abc24 Xtags3.txt /‚`‚a‚b -abc25 Xtags3.txt /‚`‚a‚b -abc26 Xtags3.txt /‚`‚a‚b -abc27 Xtags3.txt /‚`‚a‚b -abc28 Xtags3.txt /‚`‚a‚b -abc29 Xtags3.txt /‚`‚a‚b -abc30 Xtags3.txt /‚`‚a‚b -abc31 Xtags3.txt /‚`‚a‚b -abc32 Xtags3.txt /‚`‚a‚b -abc33 Xtags3.txt /‚`‚a‚b -abc34 Xtags3.txt /‚`‚a‚b -abc35 Xtags3.txt /‚`‚a‚b -abc36 Xtags3.txt /‚`‚a‚b -abc37 Xtags3.txt /‚`‚a‚b -abc38 Xtags3.txt /‚`‚a‚b -abc39 Xtags3.txt /‚`‚a‚b -abc40 Xtags3.txt /‚`‚a‚b -abc41 Xtags3.txt /‚`‚a‚b -abc42 Xtags3.txt /‚`‚a‚b -abc43 Xtags3.txt /‚`‚a‚b -abc44 Xtags3.txt /‚`‚a‚b -abc45 Xtags3.txt /‚`‚a‚b -abc46 Xtags3.txt /‚`‚a‚b -abc47 Xtags3.txt /‚`‚a‚b -abc48 Xtags3.txt /‚`‚a‚b -abc49 Xtags3.txt /‚`‚a‚b -abc50 Xtags3.txt /‚`‚a‚b -abc51 Xtags3.txt /‚`‚a‚b -abc52 Xtags3.txt /‚`‚a‚b -abc53 Xtags3.txt /‚`‚a‚b -abc54 Xtags3.txt /‚`‚a‚b -abc55 Xtags3.txt /‚`‚a‚b -abc56 Xtags3.txt /‚`‚a‚b -abc57 Xtags3.txt /‚`‚a‚b -abc58 Xtags3.txt /‚`‚a‚b -abc59 Xtags3.txt /‚`‚a‚b -abc60 Xtags3.txt /‚`‚a‚b -abc61 Xtags3.txt /‚`‚a‚b -abc62 Xtags3.txt /‚`‚a‚b -abc63 Xtags3.txt /‚`‚a‚b -abc64 Xtags3.txt /‚`‚a‚b -abc65 Xtags3.txt /‚`‚a‚b -abc66 Xtags3.txt /‚`‚a‚b -abc67 Xtags3.txt /‚`‚a‚b -abc68 Xtags3.txt /‚`‚a‚b -abc69 Xtags3.txt /‚`‚a‚b -abc70 Xtags3.txt /‚`‚a‚b -abc71 Xtags3.txt /‚`‚a‚b -abc72 Xtags3.txt /‚`‚a‚b -abc73 Xtags3.txt /‚`‚a‚b -abc74 Xtags3.txt /‚`‚a‚b -abc75 Xtags3.txt /‚`‚a‚b -abc76 Xtags3.txt /‚`‚a‚b -abc77 Xtags3.txt /‚`‚a‚b -abc78 Xtags3.txt /‚`‚a‚b -abc79 Xtags3.txt /‚`‚a‚b -abc80 Xtags3.txt /‚`‚a‚b -abc81 Xtags3.txt /‚`‚a‚b -abc82 Xtags3.txt /‚`‚a‚b -abc83 Xtags3.txt /‚`‚a‚b -abc84 Xtags3.txt /‚`‚a‚b -abc85 Xtags3.txt /‚`‚a‚b -abc86 Xtags3.txt /‚`‚a‚b -abc87 Xtags3.txt /‚`‚a‚b -abc88 Xtags3.txt /‚`‚a‚b -abc89 Xtags3.txt /‚`‚a‚b -abc90 Xtags3.txt /‚`‚a‚b -abc91 Xtags3.txt /‚`‚a‚b -abc92 Xtags3.txt /‚`‚a‚b -abc93 Xtags3.txt /‚`‚a‚b -abc94 Xtags3.txt /‚`‚a‚b -abc95 Xtags3.txt /‚`‚a‚b -abc96 Xtags3.txt /‚`‚a‚b -abc97 Xtags3.txt /‚`‚a‚b -abc98 Xtags3.txt /‚`‚a‚b -abc99 Xtags3.txt /‚`‚a‚b -abc100 Xtags3.txt /‚`‚a‚b diff --git a/src/nvim/testdir/test83.in b/src/nvim/testdir/test83.in deleted file mode 100644 index d54b1bcddd..0000000000 --- a/src/nvim/testdir/test83.in +++ /dev/null @@ -1,75 +0,0 @@ -Tests for tag search with !_TAG_FILE_ENCODING. - -STARTTEST -:so mbyte.vim -:if !has('iconv') || iconv("\x82\x60", "cp932", "utf-8") != "\uff21" -: e! test.ok -: w! test.out -: qa! -:endif - -:/^text for tags1$/,/^text for tags1$/+1w! Xtags1.txt -:/^text for tags2$/,/^text for tags2$/+1w! Xtags2.txt -:/^text for tags3$/,/^text for tags3$/+1w! Xtags3.txt -:/^tags1$/+1,/^tags1-end$/-1w! Xtags1 - -ggdG - -:call setline('.', 'Results of test83') - -:" case1: -:new -:set tags=Xtags1 -:let v:errmsg = '' -:tag abcdefghijklmnopqrs -:if v:errmsg =~ 'E426:' || getline('.') != 'abcdefghijklmnopqrs' -: close -: put ='case1: failed' -:else -: close -: put ='case1: ok' -:endif - -:" case2: -:new -:set tags=test83-tags2 -:let v:errmsg = '' -:tag /.BC -:if v:errmsg =~ 'E426:' || getline('.') != 'ABC' -: close -: put ='case2: failed' -:else -: close -: put ='case2: ok' -:endif - -:" case3: -:new -:set tags=test83-tags3 -:let v:errmsg = '' -:tag abc50 -:if v:errmsg =~ 'E426:' || getline('.') != 'ABC' -: close -: put ='case3: failed' -:else -: close -: put ='case3: ok' -:endif -:close - -:wq! test.out -ENDTEST - -text for tags1 -abcdefghijklmnopqrs - -text for tags2 -ABC - -text for tags3 -ABC - -tags1 -!_TAG_FILE_ENCODING utf-8 // -abcdefghijklmnopqrs Xtags1.txt /abcdefghijklmnopqrs -tags1-end diff --git a/src/nvim/testdir/test83.ok b/src/nvim/testdir/test83.ok deleted file mode 100644 index 61a1a04a18..0000000000 --- a/src/nvim/testdir/test83.ok +++ /dev/null @@ -1,4 +0,0 @@ -Results of test83 -case1: ok -case2: ok -case3: ok diff --git a/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua new file mode 100644 index 0000000000..cef1b312e4 --- /dev/null +++ b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua @@ -0,0 +1,209 @@ +-- Tests for tag search with !_TAG_FILE_ENCODING. + +local helpers = require('test.functional.helpers') +local insert, source, clear, expect, write_file = helpers.insert, + helpers.source, helpers.clear, helpers.expect, helpers.write_file + +describe('tag search with !_TAG_FILE_ENCODING', function() + setup(clear) + + it('is working', function() + -- Create some temp files that are needed for the test run. In the old + -- test suite this was done by putting the text inside the file test83.in + -- and executing some "/first/,/last/w! tmpfile" commands. + write_file('Xtags1.txt', [[ + text for tags1 + abcdefghijklmnopqrs + ]]) + write_file('Xtags2.txt', [[ + text for tags2 + ABC + ]]) + write_file('Xtags3.txt', [[ + text for tags3 + ABC + ]]) + write_file('Xtags1', [[ + !_TAG_FILE_ENCODING utf-8 // + abcdefghijklmnopqrs Xtags1.txt /abcdefghijklmnopqrs + ]]) + write_file('test83-tags2', + '!_TAG_FILE_ENCODING cp932 //\n' .. + '\x82`\x82a\x82b Xtags2.txt /\x82`\x82a\x82b\n' + ) + write_file('test83-tags3', + '!_TAG_FILE_SORTED 1 //\n' .. + '!_TAG_FILE_ENCODING cp932 //\n' .. + 'abc1 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc2 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc3 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc4 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc5 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc6 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc7 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc8 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc9 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc10 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc11 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc12 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc13 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc14 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc15 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc16 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc17 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc18 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc19 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc20 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc21 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc22 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc23 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc24 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc25 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc26 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc27 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc28 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc29 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc30 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc31 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc32 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc33 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc34 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc35 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc36 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc37 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc38 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc39 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc40 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc41 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc42 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc43 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc44 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc45 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc46 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc47 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc48 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc49 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc50 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc51 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc52 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc53 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc54 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc55 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc56 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc57 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc58 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc59 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc60 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc61 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc62 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc63 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc64 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc65 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc66 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc67 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc68 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc69 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc70 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc71 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc72 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc73 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc74 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc75 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc76 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc77 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc78 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc79 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc80 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc81 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc82 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc83 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc84 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc85 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc86 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc87 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc88 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc89 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc90 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc91 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc92 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc93 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc94 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc95 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc96 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc97 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc98 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc99 Xtags3.txt /\x82`\x82a\x82b\n' .. + 'abc100 Xtags3.txt /\x82`\x82a\x82b\n' + ) + + -- TODO what about the availability of iconv in neovim? + --source([[ + -- set enc=utf8 + -- if !has('iconv') || iconv("\x82\x60", "cp932", "utf-8") != "\uff21" + -- e! test.ok + -- w! test.out + -- qa! + -- endif + --]]) + + insert('Results of test83') + -- Case1: + source([[ + new + set tags=Xtags1 + let v:errmsg = '' + tag abcdefghijklmnopqrs + if v:errmsg =~ 'E426:' || getline('.') != 'abcdefghijklmnopqrs' + close + put ='case1: failed' + else + close + put ='case1: ok' + endif + ]]) + -- Case2: + source([[ + new + set tags=test83-tags2 + let v:errmsg = '' + tag /.BC + if v:errmsg =~ 'E426:' || getline('.') != 'ABC' + close + put ='case2: failed' + else + close + put ='case2: ok' + endif + ]]) + -- Case3: + source([[ + new + set tags=test83-tags3 + let v:errmsg = '' + tag abc50 + if v:errmsg =~ 'E426:' || getline('.') != 'ABC' + close + put ='case3: failed' + else + close + put ='case3: ok' + endif + ]]) + + -- Assert buffer contents. + expect([=[ + Results of test83 + case1: ok + case2: ok + case3: ok]=]) + end) + + teardown(function() + os.remove('Xtags1') + os.remove('Xtags1.txt') + os.remove('Xtags2.txt') + os.remove('Xtags3.txt') + os.remove('test83-tags2') + os.remove('test83-tags3') + end) +end) From 91a1680205f766b8fc2809f42151cf4f694e2151 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Thu, 28 May 2015 12:27:24 +0200 Subject: [PATCH 2/2] tests: Improve test 83 and add `pending()` call. If nvim was compiled without `has("iconv")` this test is skipped. --- ...083_tag_search_with_file_encoding_spec.lua | 263 ++++++------------ 1 file changed, 82 insertions(+), 181 deletions(-) diff --git a/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua index cef1b312e4..dc6df007e6 100644 --- a/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua +++ b/test/functional/legacy/083_tag_search_with_file_encoding_spec.lua @@ -4,25 +4,20 @@ local helpers = require('test.functional.helpers') local insert, source, clear, expect, write_file = helpers.insert, helpers.source, helpers.clear, helpers.expect, helpers.write_file -describe('tag search with !_TAG_FILE_ENCODING', function() - setup(clear) +local function has_iconv() + clear() -- ensures session + return 1 == helpers.eval('has("iconv")') +end - it('is working', function() +describe('tag search with !_TAG_FILE_ENCODING', function() + setup(function() + clear() -- Create some temp files that are needed for the test run. In the old -- test suite this was done by putting the text inside the file test83.in -- and executing some "/first/,/last/w! tmpfile" commands. - write_file('Xtags1.txt', [[ - text for tags1 - abcdefghijklmnopqrs - ]]) - write_file('Xtags2.txt', [[ - text for tags2 - ABC - ]]) - write_file('Xtags3.txt', [[ - text for tags3 - ABC - ]]) + write_file('Xtags1.txt', 'text for tags1\nabcdefghijklmnopqrs\n') + write_file('Xtags2.txt', 'text for tags2\nABC\n') + write_file('Xtags3.txt', 'text for tags3\nABC\n') write_file('Xtags1', [[ !_TAG_FILE_ENCODING utf-8 // abcdefghijklmnopqrs Xtags1.txt /abcdefghijklmnopqrs @@ -31,173 +26,18 @@ describe('tag search with !_TAG_FILE_ENCODING', function() '!_TAG_FILE_ENCODING cp932 //\n' .. '\x82`\x82a\x82b Xtags2.txt /\x82`\x82a\x82b\n' ) - write_file('test83-tags3', - '!_TAG_FILE_SORTED 1 //\n' .. - '!_TAG_FILE_ENCODING cp932 //\n' .. - 'abc1 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc2 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc3 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc4 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc5 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc6 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc7 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc8 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc9 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc10 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc11 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc12 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc13 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc14 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc15 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc16 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc17 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc18 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc19 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc20 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc21 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc22 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc23 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc24 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc25 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc26 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc27 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc28 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc29 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc30 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc31 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc32 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc33 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc34 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc35 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc36 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc37 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc38 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc39 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc40 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc41 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc42 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc43 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc44 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc45 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc46 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc47 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc48 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc49 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc50 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc51 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc52 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc53 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc54 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc55 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc56 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc57 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc58 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc59 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc60 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc61 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc62 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc63 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc64 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc65 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc66 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc67 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc68 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc69 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc70 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc71 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc72 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc73 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc74 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc75 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc76 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc77 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc78 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc79 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc80 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc81 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc82 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc83 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc84 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc85 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc86 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc87 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc88 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc89 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc90 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc91 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc92 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc93 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc94 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc95 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc96 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc97 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc98 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc99 Xtags3.txt /\x82`\x82a\x82b\n' .. - 'abc100 Xtags3.txt /\x82`\x82a\x82b\n' - ) - - -- TODO what about the availability of iconv in neovim? - --source([[ - -- set enc=utf8 - -- if !has('iconv') || iconv("\x82\x60", "cp932", "utf-8") != "\uff21" - -- e! test.ok - -- w! test.out - -- qa! - -- endif - --]]) - - insert('Results of test83') - -- Case1: - source([[ - new - set tags=Xtags1 - let v:errmsg = '' - tag abcdefghijklmnopqrs - if v:errmsg =~ 'E426:' || getline('.') != 'abcdefghijklmnopqrs' - close - put ='case1: failed' - else - close - put ='case1: ok' - endif - ]]) - -- Case2: - source([[ - new - set tags=test83-tags2 - let v:errmsg = '' - tag /.BC - if v:errmsg =~ 'E426:' || getline('.') != 'ABC' - close - put ='case2: failed' - else - close - put ='case2: ok' - endif - ]]) - -- Case3: - source([[ - new - set tags=test83-tags3 - let v:errmsg = '' - tag abc50 - if v:errmsg =~ 'E426:' || getline('.') != 'ABC' - close - put ='case3: failed' - else - close - put ='case3: ok' - endif - ]]) - - -- Assert buffer contents. - expect([=[ - Results of test83 - case1: ok - case2: ok - case3: ok]=]) + -- The last file is very long but repetetive and can be generated on the + -- fly. + local text = helpers.dedent([[ + !_TAG_FILE_SORTED 1 // + !_TAG_FILE_ENCODING cp932 // + ]]) + local line = ' Xtags3.txt /\x82`\x82a\x82b\n' + for i = 1, 100 do + text = text .. 'abc' .. i .. line + end + write_file('test83-tags3', text) end) - teardown(function() os.remove('Xtags1') os.remove('Xtags1.txt') @@ -206,4 +46,65 @@ describe('tag search with !_TAG_FILE_ENCODING', function() os.remove('test83-tags2') os.remove('test83-tags3') end) + + if not has_iconv() then + pending('skipped (missing iconv)', function() end) + else + it('is working', function() + + insert('Results of test83') + + -- Case1: + source([[ + new + set tags=Xtags1 + let v:errmsg = '' + tag abcdefghijklmnopqrs + if v:errmsg =~ 'E426:' || getline('.') != 'abcdefghijklmnopqrs' + close + put ='case1: failed' + else + close + put ='case1: ok' + endif + ]]) + + -- Case2: + source([[ + new + set tags=test83-tags2 + let v:errmsg = '' + tag /.BC + if v:errmsg =~ 'E426:' || getline('.') != 'ABC' + close + put ='case2: failed' + else + close + put ='case2: ok' + endif + ]]) + + -- Case3: + source([[ + new + set tags=test83-tags3 + let v:errmsg = '' + tag abc50 + if v:errmsg =~ 'E426:' || getline('.') != 'ABC' + close + put ='case3: failed' + else + close + put ='case3: ok' + endif + ]]) + + -- Assert buffer contents. + expect([[ + Results of test83 + case1: ok + case2: ok + case3: ok]]) + end) + end end)