robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
aa1d8a2702
master
1local t =require ( 'test.testutil' ) 2local n =require ( 'test.functional.testnvim' )() 3 4local describe , it , before_each , after_each , finally = 5t . describe , t . it , t . before_each , t . after_each , t . finally 6local clear =n . clear 7local eval =n . eval 8local command =n . command 9local eq =t . eq 10local fn =n . fn 11local api =n . api 12local mkdir =t . mkdir 13local rmdir =n . rmdir 14local write_file =t . write_file 15 16local cursor =n . api . nvim_win_set_cursor 17 18local function buf_word () 19local word =n . fn . expand ( '<cWORD>' ) 20local bufname =n . fn . fnamemodify ( n . fn . bufname ( '%' ), ':t' ) 21return { word , bufname } 22end 23 24local function open_helptag () 25-- n.exec [[:normal! K]] 26n . exec [[:help!]] 27local rv =buf_word () 28if n . fn . winnr ( '$' ) > 1 then 29n . command ( 'close' ) 30end 31return rv 32end 33 34local function set_lines ( text ) 35n . exec_lua ( 36[[ 37vim.cmd'%delete _' 38vim.api.nvim_paste(vim.text.indent(-1, ...), false, -1) 39]] , 40text 41) 42end 43 44describe ( ':help' , function () 45before_each ( clear ) 46 47it ( '{subject}' , function () 48n . command ( 'helptags ++t $VIMRUNTIME/doc' ) 49local function check_tag ( cmd , tag ) 50local cmd_ok =t . pcall ( n . command , cmd ) 51local found =n . api . nvim_get_current_line (): find ( tag , 1 , true ) 52local errmsg =( not cmd_ok and 'command failed' ) or ( not found and 'tag not found' ) or '?' 53assert ( 54cmd_ok and found , 55string . format ( 'Expected `:%s` to jump to tag `%s`, but %s' , cmd , tag , errmsg ) 56) 57n . command ( 'helpclose' ) 58end 59 60check_tag ( 'help' , '*help.txt*' ) 61check_tag ( 'help |' , '*bar*' ) 62check_tag ( 'help "*' , '*quotestar*' ) 63check_tag ( 'help ch??khealth' , '*:checkhealth*' ) 64 65check_tag ( [[help \\star]] , [[*/\star*]] ) 66check_tag ( 'help /*' , [[*/\star*]] ) 67check_tag ( 'help ?' , '*?*' ) 68check_tag ( 'help ??' , '*??*' ) 69check_tag ( 'help expr-!=?' , '*expr-!=?*' ) 70 71check_tag ( 'help /<cr>' , '*/<CR>*' ) 72check_tag ( [[help %(\\)]] , [[*/\%(\)*]] ) 73check_tag ( 'help %^' , [[/\%^]] ) 74check_tag ( 'help /_^G' , '/_CTRL-G' ) 75check_tag ( [[help \0]] , [[\0]] ) 76 77check_tag ( 'help !' , '*!*' ) 78check_tag ( 'help #{}' , '*#{}*' ) 79check_tag ( 'help %:8' , '*%:8*' ) 80check_tag ( 'help &' , '*&*' ) 81check_tag ( [[help '']] , [[*''*]] ) 82check_tag ( [[help '(]] , [[*'(*]] ) 83check_tag ( [[help '0]] , [[*'0*]] ) 84check_tag ( [[help 'ac']] , [[*'ac'*]] ) 85check_tag ( [[help '{]] , [[*'{*]] ) 86check_tag ( 'help )' , '*)*' ) 87check_tag ( 'help +' , '*+*' ) 88 89check_tag ( 'help +opt' , '*++opt*' ) 90check_tag ( 'help --' , '*--*' ) 91check_tag ( 'help -?' , '*-?*' ) 92check_tag ( 'help .' , '*.*' ) 93check_tag ( 'help :' , '*:*' ) 94check_tag ( [[help :'}]] , [[*:'}*]] ) 95check_tag ( 'help :,' , '*:,*' ) 96check_tag ( 'help :<abuf>' , '*:<abuf>*' ) 97check_tag ( [[help :\|]] , [[*:\bar*]] ) 98check_tag ( [[help :\\|]] , [[*:\bar*]] ) 99check_tag ( 'help _' , '*_*' ) 100check_tag ( 'help `' , '*`*' ) 101check_tag ( 'help `(' , '*`(*' ) 102check_tag ( [[help `:ls`.]] , [[*:ls*]] ) 103 104check_tag ( 'help [' , '*[*' ) 105check_tag ( 'help [#' , '*[#*' ) 106check_tag ( [[help [']] , [[*['*]] ) 107check_tag ( 'help [(' , '*[(*' ) 108check_tag ( 'help [++opt]' , '*[++opt]*' ) 109check_tag ( 'help [:tab:]' , '*[:tab:]*' ) 110check_tag ( 'help [count]' , '*[count]*' ) 111check_tag ( 'help :[range]' , '*:[range]*' ) 112check_tag ( 'help [<space>' , '[<Space>' ) 113check_tag ( 'help ]_^D' , ']_CTRL-D' ) 114check_tag ( 'help :set^=' , '*:set^=*' ) 115 116check_tag ( [[help $HOME]] , [[*$HOME*]] ) 117 118check_tag ( 'help <C-pagedown>' , '*CTRL-<PageDown>*' ) 119check_tag ( 'help ^A' , '*CTRL-A*' ) 120check_tag ( 'help ^W_+' , '*CTRL-W_+*' ) 121check_tag ( 'help ^W<up>' , '*CTRL-W_<Up>*' ) 122check_tag ( 'help ^W>' , '*CTRL-W_>*' ) 123check_tag ( 'help ^W^]' , '*CTRL-W_CTRL-]*' ) 124check_tag ( 'help ^W^' , '*CTRL-W_^*' ) 125check_tag ( 'help ^W|' , '*CTRL-W_bar*' ) 126check_tag ( 'help ^Wg<tab>' , '*CTRL-W_g<Tab>*' ) 127check_tag ( 'help ^]' , '*CTRL-]*' ) 128check_tag ( 'help ^{char}' , 'CTRL-{char}' ) 129check_tag ( 'help [^L' , '[_CTRL-L' ) 130check_tag ( 'help <C-' , '*<C-*' ) 131check_tag ( 'help <S-CR>' , '*<S-CR>*' ) 132check_tag ( 'help <<' , '*<<*' ) 133check_tag ( 'help <>' , '*<>*' ) 134check_tag ( [[help i^x^y]] , '*i_CTRL-X_CTRL-Y*' ) 135check_tag ( [[help CTRL-\_CTRL-N]] , [[*CTRL-\_CTRL-N*]] ) 136check_tag ( [[help i_CTRL-U-default]] , [[*i_CTRL-U-default*]] ) 137check_tag ( [[help expr-=~?]] , [[*expr-=~?*]] ) 138check_tag ( [[help map-CTRL-C]] , '*map-CTRL-C*' ) 139check_tag ( [=[help telnet-CTRL-]]=] , '*telnet-CTRL-]*' ) 140check_tag ( [[help c_CTRL-SHIFT-V]] , '*c_CTRL-SHIFT-V*' ) 141check_tag ( [[help i_CTRL-SHIFT-V]] , '*i_CTRL-SHIFT-V*' ) 142check_tag ( [[help c_CTRL-SHIFT-Q]] , '*c_CTRL-SHIFT-Q*' ) 143 144check_tag ( [[exe "help i\<C-\>\<C-G>"]] , [[*i_CTRL-\_CTRL-G*]] ) 145check_tag ( [[exe "help \<C-V>"]] , '*CTRL-V*' ) 146check_tag ( [[exe "help! arglistid([{winnr})"]] , '*arglistid()*' ) 147check_tag ( [[exe "help! 'autoindent'."]] , [[*'autoindent'*]] ) 148 149check_tag ( 'exusage' , '*:index*' ) 150check_tag ( 'viusage' , '*normal-index*' ) 151 152-- Test cases for removed exceptions 153check_tag ( 'help /\\(\\)' , '*/\\(\\)*' ) 154check_tag ( 'help :s\\=' , '*:s\\=*' ) 155check_tag ( [[help expr-']] , [[*expr-'*]] ) 156check_tag ( 'help expr-barbar' , '*expr-barbar*' ) 157check_tag ( [[help s/\9]] , [[*s/\9*]] ) 158check_tag ( [[help s/\U]] , [[*s/\U*]] ) 159check_tag ( [[help s/\~]] , [[*s/\~*]] ) 160check_tag ( [[help \|]] , [[*/\bar*]] ) 161end ) 162 163it ( '":help!" (bang + no args) guesses the best tag near cursor' , function () 164n . command ( 'helptags ++t $VIMRUNTIME/doc' ) 165-- n.command('enew') 166-- n.command('set filetype=help') 167-- n.command [[set keywordprg=:help]] 168 169-- Failure modes: 170set_lines '' 171cursor ( 0 , { 1 , 1 } ) 172t . matches ( 'E349: No identifier under cursor' , t . pcall_err ( n . exec , [[:help!]] )) 173 174set_lines 'xxxxxxxxx' 175cursor ( 0 , { 1 , 4 } ) 176t . matches ( 'E149: No help for xxxxxxxxx' , t . pcall_err ( n . exec , [[:help!]] )) 177 178-- Success: 179 180set_lines 'some plain text' 181cursor ( 0 , { 1 , 5 } ) -- on 'plain' 182eq ( { '*ft-plaintex-syntax*' , 'syntax.txt' } , open_helptag ()) 183 184set_lines ':help command' 185cursor ( 0 , { 1 , 4 } ) 186eq ( { '*:help*' , 'helphelp.txt' } , open_helptag ()) 187 188set_lines ' :help command' 189cursor ( 0 , { 1 , 5 } ) 190eq ( { '*:command*' , 'map.txt' } , open_helptag ()) 191 192set_lines 'v:version name' 193cursor ( 0 , { 1 , 5 } ) 194eq ( { '*v:version*' , 'vvars.txt' } , open_helptag ()) 195cursor ( 0 , { 1 , 2 } ) 196eq ( { '*v:version*' , 'vvars.txt' } , open_helptag ()) 197 198set_lines "See 'option' for more." 199cursor ( 0 , { 1 , 6 } ) -- on 'option' 200eq ( { "*'option'*" , 'helphelp.txt' } , open_helptag ()) 201 202set_lines ':command-nargs' 203cursor ( 0 , { 1 , 7 } ) -- on 'nargs' 204eq ( { '*:command-nargs*' , 'map.txt' } , open_helptag ()) 205 206set_lines '|("vim.lsp.foldtext()")|' 207cursor ( 0 , { 1 , 10 } ) 208eq ( { '*vim.lsp.foldtext()*' , 'lsp.txt' } , open_helptag ()) 209 210set_lines 'nvim_buf_detach_event[{buf}]' 211cursor ( 0 , { 1 , 10 } ) 212eq ( { '*nvim_buf_detach_event*' , 'api.txt' } , open_helptag ()) 213 214set_lines '{buf}' 215cursor ( 0 , { 1 , 1 } ) 216eq ( { '*:buf*' , 'windows.txt' } , open_helptag ()) 217 218set_lines '(`vim.lsp.ClientConfig`)' 219cursor ( 0 , { 1 , 1 } ) 220eq ( { '*vim.lsp.ClientConfig*' , 'lsp.txt' } , open_helptag ()) 221 222set_lines "vim.lsp.enable('clangd')" 223cursor ( 0 , { 1 , 3 } ) 224eq ( { '*vim.lsp.enable()*' , 'lsp.txt' } , open_helptag ()) 225 226set_lines "vim.lsp.enable('clangd')" 227cursor ( 0 , { 1 , 6 } ) 228eq ( { '*vim.lsp.enable()*' , 'lsp.txt' } , open_helptag ()) 229 230set_lines "vim.lsp.enable('clangd')" 231cursor ( 0 , { 1 , 9 } ) 232eq ( { '*vim.lsp.enable()*' , 'lsp.txt' } , open_helptag ()) 233 234set_lines 'assert(vim.lsp.get_client_by_id(client_id))' 235cursor ( 0 , { 1 , 12 } ) 236eq ( { '*vim.lsp.get_client_by_id()*' , 'lsp.txt' } , open_helptag ()) 237 238set_lines "vim.api.nvim_create_autocmd('LspAttach', {" 239cursor ( 0 , { 1 , 7 } ) 240eq ( { '*nvim_create_autocmd()*' , 'api.txt' } , open_helptag ()) 241 242-- Falls back to <cword> when all trimming fails. 243set_lines "'@lsp.type.function'" 244cursor ( 0 , { 1 , 2 } ) -- on 'lsp' 245eq ( { '*lsp*' , 'lsp.txt' } , open_helptag ()) 246set_lines "'@lsp.type.function'" 247cursor ( 0 , { 1 , 14 } ) -- on 'function' 248eq ( { '*:function*' , 'userfunc.txt' } , open_helptag ()) 249 250set_lines ' • `@lsp.type.<type>.<ft>` for the type' 251cursor ( 0 , { 1 , 6 } ) -- on backtick '`' (byte 6, after 2 spaces + 3-byte '•' + space) 252eq ( { '*lsp*' , 'lsp.txt' } , open_helptag ()) 253 254set_lines [[ 255- `root_dir` usages akin to >lua 256root_dir = require'lspconfig.util'.root_pattern(...) 257< 258require'lspconfig.util'.root_pattern(...) 259]] 260cursor ( 0 , { 2 , 17 } ) -- on "require" 261eq ( { '*require()*' , 'luaref.txt' } , open_helptag ()) 262 263set_lines '`:lsp restart`. You' 264cursor ( 0 , { 1 , 6 } ) -- on "restart" 265eq ( { '*:restart*' , 'gui.txt' } , open_helptag ()) 266 267-- 268-- Test with actual helpfiles. This affects getcompletion(…,'help') ... 269-- 270 271n . command ( ':help lua' ) 272n . feed ( 'gg/package.searchpath<cr>' ) 273eq ( { "vim.cmd.edit(package.searchpath('jit.p'," , 'lua.txt' } , buf_word ()) 274-- ^ cursor on "package" 275n . command ( ':help!' ) 276eq ( { '*packages*' , 'pack.txt' } , buf_word ()) 277 278n . command ( ':help lsp' ) 279n . feed ( 'gg/type.<lt>type><cr>' ) 280eq ( { '`@lsp.type.<type>.<ft>`' , 'lsp.txt' } , buf_word ()) 281-- ^ cursor on "type" 282n . command ( ':help!' ) 283eq ( { '*type()*' , 'vimfn.txt' } , buf_word ()) 284n . feed ( '<c-o>f<lt>' ) 285eq ( { '`@lsp.type.<type>.<ft>`' , 'lsp.txt' } , buf_word ()) 286-- ^ cursor on "<" 287n . command ( ':help!' ) 288 289n . command ( ':help lsp' ) 290n . feed ( 'gg/codelens.run()|<cr>' ) 291eq ( { '|vim.lsp.codelens.run()|' , 'lsp.txt' } , buf_word ()) 292-- ^ cursor on "codelens" 293n . command ( ':help!' ) 294eq ( { '*vim.lsp.codelens.run()*' , 'lsp.txt' } , buf_word ()) 295end ) 296 297it ( 'K resolves generic type names in help' , function () 298command ( 'helptags ++t $VIMRUNTIME/doc' ) 299for _ , ty in ipairs ( { 300'vim.async.Task<R>' , 301'vim.async.Task<R...>' , 302'vim.async.Task<R>[]' , 303} ) do 304command ( 'help lua-async' ) 305command ( 'setlocal keywordprg=:help!' ) 306assert ( fn . search ( '\\V(`' .. ty .. '`)' , 'W' ) > 0 ) 307command ( 'normal! fTK' ) 308eq ( { '*vim.async.Task*' , 'lua-async.txt' } , buf_word ()) 309end 310end ) 311 312it ( 'K resolves nullable type names in help' , function () 313command ( 'helptags ++t $VIMRUNTIME/doc' ) 314for _ , ref in ipairs ( { 315{ 'lsp' , 'vim.lsp.Client' , '?' } , 316{ 'diagnostic' , 'vim.Diagnostic' , '?' } , 317{ 'diagnostic' , 'vim.Diagnostic' , '[]?' } , 318} ) do 319command ( 'help ' .. ref [ 1 ]) 320command ( 'setlocal keywordprg=:help!' ) 321assert ( fn . search ( '\\V(`' .. ref [ 2 ] .. ref [ 3 ] .. '`)' , 'W' ) > 0 ) 322command ( 'normal! 2lK' ) 323eq ( { '*' .. ref [ 2 ] .. '*' , ref [ 1 ] .. '.txt' } , buf_word ()) 324end 325end ) 326 327it ( 'window closed makes cursor return to a valid win/buf #9773' , function () 328n . add_builddir_to_rtp () 329command ( 'help help' ) 330eq ( 1001 , fn . win_getid ()) 331command ( 'quit' ) 332eq ( 1000 , fn . win_getid ()) 333 334command ( 'autocmd WinNew * wincmd p' ) 335 336command ( 'help help' ) 337-- Window 1002 is opened, but the autocmd switches back to 1000 and 338-- creates the help buffer there instead. 339eq ( 1000 , fn . win_getid ()) 340command ( 'quit' ) 341-- Before #9773, Nvim would crash on quitting the help window. 342eq ( 1002 , fn . win_getid ()) 343end ) 344 345it ( 'multibyte help tags work #23975' , function () 346mkdir ( 'Xhelptags' ) 347finally ( function () 348rmdir ( 'Xhelptags' ) 349end ) 350mkdir ( 'Xhelptags/doc' ) 351write_file ( 'Xhelptags/doc/Xhelptags.txt' , '*…*' ) 352command ( 'helptags Xhelptags/doc' ) 353command ( 'set rtp+=Xhelptags' ) 354command ( 'help …' ) 355eq ( '*…*' , api . nvim_get_current_line ()) 356end ) 357end ) 358 359describe ( ':helptags' , function () 360before_each ( function () 361for _ , sfx in ipairs ( { '' , '2' } ) do 362fn . mkdir (( 'Xhelptags%s/doc' ): format ( sfx ), 'p' ) 363for _ , tag in ipairs ( { 'Xa' , 'Xb' } ) do 364write_file (( 'Xhelptags%s/doc/%s%s.txt' ): format ( sfx , tag , sfx ), ( '*%s%s*' ): format ( tag , sfx )) 365end 366end 367 368clear () 369command ( 'set rtp+=Xhelptags,Xhelptags2' ) 370end ) 371 372after_each ( function () 373rmdir ( 'Xhelptags' ) 374rmdir ( 'Xhelptags2' ) 375end ) 376 377it ( 'requires an argument' , function () 378local msg =t . pcall_err ( command , 'helptags' ) 379eq ( true , msg : find ( 'E471' ) ~= nil ) 380end ) 381 382it ( '{dir}' , function () 383-- Helpfiles in sub-directories are found and named relative to {dir}. 384fn . mkdir ( 'Xhelptags/doc/sub' , 'p' ) 385-- A "|" in a tag would break |links|, and "*Xd" is not closed, so neither is a tag. 386write_file ( 'Xhelptags/doc/sub/Xc.txt' , '*Xc*\n*X|c*\n*Xd\n' ) 387-- CRLF helpfile: "\r" must not confuse the parser into finding tags in an example. 388write_file ( 'Xhelptags/doc/Xe.txt' , '*Xe*\r\n>\r\n\t+-----+\r\n\t|/* a.c */ |/* b.c */ |\r\n' ) 389 390for _ , dir in ipairs ( { 391'Xhelptags/doc' , 392'./Xhelptags/doc' , 393fn . fnamemodify ( 'Xhelptags/doc' , ':p' ), 394} ) do 395command ( 'helptags ' .. fn . fnameescape ( dir )) 396eq ( { 397'Xa\tXa.txt\t/*Xa*' , 398'Xb\tXb.txt\t/*Xb*' , 399'Xc\tsub/Xc.txt\t/*Xc*' , 400'Xe\tXe.txt\t/*Xe*' , 401} , fn . readfile ( 'Xhelptags/doc/tags' )) 402end 403 404command ( 'help Xa' ) 405eq ( '*Xa*' , api . nvim_get_current_line ()) 406 407command ( 'help Xc' ) 408eq ( '*Xc*' , api . nvim_get_current_line ()) 409end ) 410 411it ( 'ignores tags in examples and resumes after unindented text' , function () 412for _ , newline in ipairs ( { '\n' , '\r\n' } ) do 413write_file ( 414'Xhelptags/doc/Xa.txt' , 415table . concat ( { 416'*Xa* *Xz*' , 417'Some ordinary prose.' , 418'prefix*invalid* *invalid*suffix *bad|tag* **' , 419'>lua' , 420'' , 421' *example*' , 422'End of example.' , 423'' , 424' *Xc*' , 425'More ordinary prose.' , 426'*Xd*' , -- No final newline. 427} , newline ), 428true 429) 430command ( 'helptags Xhelptags/doc' ) 431eq ( { 432'Xa\tXa.txt\t/*Xa*' , 433'Xb\tXb.txt\t/*Xb*' , 434'Xc\tXa.txt\t/*Xc*' , 435'Xd\tXa.txt\t/*Xd*' , 436'Xz\tXa.txt\t/*Xz*' , 437} , fn . readfile ( 'Xhelptags/doc/tags' )) 438end 439end ) 440 441it ( 'overwrites existing tags file' , function () 442write_file ( 'Xhelptags/doc/tags' , 'Xstale Xold.txt /*Xstale*' , nil , true ) 443write_file ( 'Xhelptags/doc/Xa.txt' , 'no tags here' , nil , true ) 444write_file ( 'Xhelptags/doc/Xb.txt' , 'no tags here' , nil , true ) 445 446command ( 'helptags Xhelptags/doc' ) 447eq ( {} , eval ( "readfile('Xhelptags/doc/tags')" )) 448end ) 449 450it ( 'reports E150 E151 E152' , function () 451eq ( true , t . pcall_err ( command , 'helptags Xhelptags/doc/Xa.txt' ): find ( 'E150' ) ~= nil ) 452 453fn . mkdir ( 'Xhelptags/Xempty' , 'p' ) 454eq ( true , t . pcall_err ( command , 'helptags Xhelptags/Xempty' ): find ( 'E151' ) ~= nil ) 455 456-- A directory named "tags" cannot be opened for writing. 457fn . mkdir ( 'Xhelptags/doc/tags' , 'p' ) 458eq ( true , t . pcall_err ( command , 'helptags Xhelptags/doc' ): find ( 'E152' ) ~= nil ) 459end ) 460 461it ( 'ALL' , function () 462command ( 'helptags ALL' ) 463 464eq ( eval ( "['Xa Xa.txt /*Xa*','Xb Xb.txt /*Xb*']" ), eval ( "readfile('Xhelptags/doc/tags')" )) 465eq ( eval ( "['Xa2 Xa2.txt /*Xa2*','Xb2 Xb2.txt /*Xb2*']" ), eval ( "readfile('Xhelptags2/doc/tags')" )) 466 467command ( 'help Xa2' ) 468eq ( '*Xa2*' , api . nvim_get_current_line ()) 469end ) 470 471it ( '++t' , function () 472write_file ( 'Xhelptags/doc/Xa.nlx' , '*Xa*' , nil , true ) 473 474command ( 'helptags ++t Xhelptags/doc' ) 475eq ( 'help-tags tags 1' , eval ( "readfile('Xhelptags/doc/tags')[-1]" )) 476-- Each language gets a "help-tags" tag naming its own tags file. 477eq ( 'help-tags tags-nl 1' , eval ( "readfile('Xhelptags/doc/tags-nl')[-1]" )) 478end ) 479 480it ( 'generates help-tag tag for VIMRUNTIME' , function () 481command ( 'let $VIMRUNTIME="Xhelptags"' ) 482command ( 'helptags Xhelptags/doc' ) 483eq ( 'help-tags tags 1' , eval ( "readfile('Xhelptags/doc/tags')[-1]" )) 484end ) 485 486it ( 'errors on duplicate tags' , function () 487-- duplicate tags in different files 488write_file ( 'Xhelptags/doc/Xd.txt' , '*Xa*' , nil , true ) 489local msg =t . pcall_err ( command , 'helptags Xhelptags/doc' ) 490eq ( true , msg : find ( 'E154: Duplicate tag "Xa" in Xd.txt and Xa.txt' , 1 , true ) ~= nil ) 491 492-- tags file should still be generated 493eq ( 1 , eval ( "filereadable('Xhelptags/doc/tags')" )) 494 495os . remove ( 'Xhelptags/doc/Xd.txt' ) 496 497-- duplicate tags in same file 498write_file ( 'Xhelptags/doc/Xa.txt' , '\n*Xa*' , nil , true ) 499 500msg =t . pcall_err ( command , 'helptags Xhelptags/doc' ) 501eq ( true , msg : find ( 'E154: Duplicate tag "Xa" in Xa.txt' , 1 , true ) ~= nil ) 502 503eq ( 1 , eval ( "filereadable('Xhelptags/doc/tags')" )) 504 505-- Duplicates do not abort the run: other languages are still processed. 506write_file ( 'Xhelptags/doc/Xa.nlx' , '*Xnl*' , nil , true ) 507 508msg =t . pcall_err ( command , 'helptags Xhelptags/doc' ) 509eq ( true , msg : find ( 'E154' ) ~= nil ) 510eq ( false , msg : find ( 'E5108' ) ~= nil ) 511eq ( 1 , eval ( "filereadable('Xhelptags/doc/tags-nl')" )) 512end ) 513 514it ( 'with translated help files' , function () 515write_file ( 'Xhelptags/doc/Xa.nlx' , '*Xa*' , nil , true ) 516-- The suffix is matched case-insensitively. 517write_file ( 'Xhelptags/doc/Xc.FRX' , '*Xc*' , nil , true ) 518 519command ( 'helptags Xhelptags/doc' ) 520eq ( eval ( "['Xa Xa.nlx /*Xa*']" ), eval ( "readfile('Xhelptags/doc/tags-nl')" )) 521eq ( eval ( "['Xc Xc.FRX /*Xc*']" ), eval ( "readfile('Xhelptags/doc/tags-fr')" )) 522end ) 523end )