Merge pull request #34137 from brianhuster/vim-2323f22

vim-patch: add chapter 2 of beginner tutor
This commit is contained in:
zeertzjq
2025-05-24 06:48:34 +08:00
committed by GitHub
7 changed files with 273 additions and 44 deletions

View File

@@ -14,3 +14,21 @@ func Test_auto_enable_interactive()
call assert_true(empty(&buftype))
call assert_match('tutor#EnableInteractive', b:undo_ftplugin)
endfunc
func Test_tutor_link()
let tutor_files = globpath($VIMRUNTIME, 'tutor/**/*.tutor', 0, 1)
let pattern = '\[.\{-}@tutor:\zs[^)\]]*\ze[)\]]'
for tutor_file in tutor_files
let lang = fnamemodify(tutor_file, ':h:t')
if lang == 'tutor'
let lang = 'en'
endif
let text = readfile(tutor_file)
let links = matchstrlist(text, pattern)->map({_, v -> v.text})
for link in links
call assert_true(tutor#GlobTutorials(link, lang)->len() > 0)
endfor
endfor
endfunc