From a541f1de2bfdd18d927974bc13fe5d4ee3cb5698 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ph=E1=BA=A1m=20B=C3=ACnh=20An?= Date: Sun, 1 Jun 2025 18:58:09 +0200 Subject: [PATCH] patch 9.1.1421: tests: need a test for the new-style tutor.tutor MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Problem: tests: need a test for the new-style tutor.tutor, patch 9.1.1384 broke the expected positions for the signs Solution: Update all number keys in tutor.tutor.json to match the correct line numbers in tutor.tutor, replace tabs by spaces, add a screen-dump test to verify it does not regress (Pham Bình An) closes: #17416 Signed-off-by: Phạm Bình An Signed-off-by: Christian Brabandt --- runtime/tutor/tutor.tutor.json | 66 +++++++++---------- .../dumps/Test_plugin_tutor_mark_1.dump | 20 ++++++ src/testdir/test_plugin_tutor.vim | 21 ++++++ src/version.c | 2 + 4 files changed, 76 insertions(+), 33 deletions(-) create mode 100644 src/testdir/dumps/Test_plugin_tutor_mark_1.dump diff --git a/runtime/tutor/tutor.tutor.json b/runtime/tutor/tutor.tutor.json index bf3eae8586..4fb18fbdc3 100644 --- a/runtime/tutor/tutor.tutor.json +++ b/runtime/tutor/tutor.tutor.json @@ -1,35 +1,35 @@ { - "expect": { - "63": "This is text with **important information**", - "64": "This is text with **important information**", - "71": "Document '&variable'", - "72": "Document '&variable'", - "78": "# This is a level 1 header", - "79": "# This is a level 1 header", - "80": "### This is a level 3 header", - "81": "### This is a level 3 header", - "82": "# This is a header with a label {*label*}", - "83": "# This is a header with a label {*label*}", - "108": "A link to help for the ['breakindent']('breakindent') option", - "109": "A link to help for the ['breakindent']('breakindent') option", - "123": "A link to the [Links](*links*) section", - "124": "A link to the [Links](*links*) section", - "139": "A link to [the vim-tutor-mode tutorial](@tutor:tutor)", - "140": "A link to [the vim-tutor-mode tutorial](@tutor:tutor)", - "157": "~~~ viml", - "158": "echom 'the value of &number is'.string(&number)", - "159": "~~~", - "161": "~~~ viml", - "162": "echom 'the value of &number is'.string(&number)", - "163": "~~~", - "188": "~~~ normal", - "189": "d2w", - "190": "~~~", - "192": "~~~ normal", - "193": "d2w", - "194": "~~~", - "206": "`d2w`{normal}", - "207": "`d2w`{normal}", - "244": -1 - } + "expect": { + "56": "This is text with **important information**", + "57": "This is text with **important information**", + "64": "Document '&variable'", + "65": "Document '&variable'", + "71": "# This is a level 1 header", + "72": "# This is a level 1 header", + "73": "### This is a level 3 header", + "74": "### This is a level 3 header", + "75": "# This is a header with a label {*label*}", + "76": "# This is a header with a label {*label*}", + "101": "A link to help for the ['breakindent']('breakindent') option", + "102": "A link to help for the ['breakindent']('breakindent') option", + "116": "A link to the [Links](*links*) section", + "117": "A link to the [Links](*links*) section", + "132": "A link to [the vim-tutor-mode tutorial](@tutor:tutor)", + "133": "A link to [the vim-tutor-mode tutorial](@tutor:tutor)", + "150": "~~~ viml", + "151": "echom 'the value of &number is'.string(&number)", + "152": "~~~", + "154": "~~~ viml", + "155": "echom 'the value of &number is'.string(&number)", + "156": "~~~", + "181": "~~~ normal", + "182": "d2w", + "183": "~~~", + "185": "~~~ normal", + "186": "d2w", + "187": "~~~", + "199": "`d2w`{normal}", + "200": "`d2w`{normal}", + "237": -1 + } } diff --git a/src/testdir/dumps/Test_plugin_tutor_mark_1.dump b/src/testdir/dumps/Test_plugin_tutor_mark_1.dump new file mode 100644 index 0000000000..75028c3ac5 --- /dev/null +++ b/src/testdir/dumps/Test_plugin_tutor_mark_1.dump @@ -0,0 +1,20 @@ +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@7|"|2|"|:| |"|T|h|i|s| |i|s| |h|o|w| |t|h|i|s| |l|i|n|e| |s|h|o|u|l|d| |l|o@1|k|.|"|,| @25 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@7|"|3|"|:| |-|1| @60 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|}| @70 +| +0#0000e05#a8a8a8255@1|}+0#0000000#ffffff0| @74 +| +0#0000e05#a8a8a8255@1|~+0#e000e06#ffffff0@2| +0#0000000&@72 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@75 +| +0#0000e05#a8a8a8255@1|T+0#0000000#ffffff0|h|e|s|e| |f|i|l|e|s| |c|o|n|t|a|i|n| |a|n| |"|e|x|p|e|c|t|"| |d|i|c|t|i|o|n|a|r|y|,| |f|o|r| |w|h|i|c|h| |t|h|e| |k|e|y|s| |a|r|e| |l|i|n|e| |n|u|m|b +| +0#0000e05#a8a8a8255@1|e+0#0000000#ffffff0|r|s| |a|n|d| @68 +| +0#0000e05#a8a8a8255@1|t+0#0000000#ffffff0|h|e| |v|a|l|u|e|s| |a|r|e| |t|h|e| |e|x|p|e|c|t|e|d| |t|e|x|t|.| |A| |v|a|l|u|e| |o|f| |-|1| |m|e|a|n|s| |t|h|a|t| |t|h|e| |c|o|n|d|i|t|i|o|n| |f|o|r +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0|t|h|e| |l|i|n|e| @66 +| +0#0000e05#a8a8a8255@1|w+0#0000000#ffffff0|i|l@1| |a|l|w|a|y|s| |b|e| |s|a|t|i|s|f|i|e|d|,| |n|o| |m|a|t@1|e|r| |w|h|a|t| |(|t|h|i|s| |i|s| |u|s|e|f|u|l| |f|o|r| |l|e|t@1|i|n|g| |t|h|e| |u|s|e +| +0#0000e05#a8a8a8255@1|r+0#0000000#ffffff0| |p|l|a|y| |a| |b|i|t|)|.| @61 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@75 +|✓+2#40ff4011&| |T+0#e000e06&|h|i|s| |i|s| |a|n| |"|e|x|p|e|c|t|"| |l|i|n|e| |t|h|a|t| |i|s| |a|l|w|a|y|s| |s|a|t|i|s|f|i|e|d|.| |T|r|y| |c|h|a|n|g|i|n|g| |i|t|.| +0#0000000&@8 +| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@75 +| +0#0000e05#a8a8a8255@1|T+0#0000000#ffffff0|h|e|s|e| |f|i|l|e|s| |c|o|n|v|e|n|t|i|o|n|a|l@1|y| |h|a|v|e| |t|h|e| |s|a|m|e| |n|a|m|e| |a|s| |t|h|e| |t|u|t|o|r|i|a|l| |d|o|c|u|m|e|n|t| |w|i|t|h| +| +0#0000e05#a8a8a8255@1|t+0#0000000#ffffff0|h|e| |.|j|s|o|n| @66 +| +0#0000e05#a8a8a8255@1>e+0#0000000#ffffff0|x|t|e|n|s|i|o|n| |a|p@1|e|n|d|e|d| |(|f|o|r| |a| |f|u|l@1| |e|x|a|m|p|l|e|,| |s|e@1| |t|h|e| |f|i|l|e| |t|h|a|t| |c|o|r@1|e|s|p|o|n|d|s| |t|o| |t|h|i +| +0#0000e05#a8a8a8255@1|s+0#0000000#ffffff0| |t|u|t|o|r|i|a|l|)|.| @63 +|:|2|4|0| @55|2|4|0|,|1| @8|B|o|t| diff --git a/src/testdir/test_plugin_tutor.vim b/src/testdir/test_plugin_tutor.vim index 3dc46fd16e..5b85b650e2 100644 --- a/src/testdir/test_plugin_tutor.vim +++ b/src/testdir/test_plugin_tutor.vim @@ -1,5 +1,9 @@ " Test for the new-tutor plugin +source screendump.vim +source check.vim +source script_util.vim + func SetUp() set nocompatible runtime plugin/tutor.vim @@ -32,3 +36,20 @@ func Test_tutor_link() endfor endfor endfunc + +func Test_mark() + CheckScreendump + call writefile([ + \ 'set nocompatible', + \ 'runtime plugin/tutor.vim', + \ 'Tutor tutor', + \ 'set statusline=', + \ ], 'Xtest_plugin_tutor_mark', 'D') + let buf = RunVimInTerminal('-S Xtest_plugin_tutor_mark', {'rows': 20, 'cols': 78}) + call term_sendkeys(buf, ":240\") + call WaitForAssert({-> assert_match('Bot$', term_getline(buf, 20))}) + call VerifyScreenDump(buf, 'Test_plugin_tutor_mark_1', {}) + + " clean up + call StopVimInTerminal(buf) +endfunc diff --git a/src/version.c b/src/version.c index 2316def10e..7530124033 100644 --- a/src/version.c +++ b/src/version.c @@ -709,6 +709,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1421, /**/ 1420, /**/ -- 2.47.2