patch 9.1.1404: wrong link to Chapter 2 in new-tutor
Problem: wrong link to Chapter 2 in vim-01-beginner.tutor
Solution: Fix the link to Chapter 2, add test for links in tutor files
(Phạm Bình An)
In order to write the test, I expose the function `s:GlobTutorials` as
`tutor#GlobTutorials` and make it also accept a `locale` argument.
closes: #17356
Signed-off-by: Phạm Bình An <111893501+brianhuster@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_plugin_tutor.vim b/src/testdir/test_plugin_tutor.vim
index 61cea3f..3dc46fd 100644
--- a/src/testdir/test_plugin_tutor.vim
+++ b/src/testdir/test_plugin_tutor.vim
@@ -14,3 +14,21 @@
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
diff --git a/src/version.c b/src/version.c
index f94dbe3..9cecc0b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -710,6 +710,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1404,
+/**/
1403,
/**/
1402,