From e0a04e11b8182e0086af902b7a62916565cf4791 Mon Sep 17 00:00:00 2001 From: Tinmarino Date: Thu, 22 Jun 2023 12:41:02 -0400 Subject: [PATCH] CI: Add test for highlight dates (issue #309, pr #1315) --- test/issue_1315_hi_date.vader | 36 +++++++++++++++++++++++++++++++++++ test/issue_example.vader | 16 ++++++++++++++++ test/vimrc | 8 ++++++++ 3 files changed, 60 insertions(+) create mode 100644 test/issue_1315_hi_date.vader create mode 100644 test/issue_example.vader diff --git a/test/issue_1315_hi_date.vader b/test/issue_1315_hi_date.vader new file mode 100644 index 0000000..550ca39 --- /dev/null +++ b/test/issue_1315_hi_date.vader @@ -0,0 +1,36 @@ +# Non regression tests for issue: +# -- How to turn off inline math highlights? + + + +Given vimwiki (All math inline possible): + 12345678901234567890123456789 + 2023-06-22 + 23-06-22 + due:2023-06-22 + + +ProjectName project description + @ContextName context description + + Other +ProjectName and desc + Other @ContectName and desc + +Execute (Assert all lines): +# Math + AssertEqual 'normal', GetSyntaxVimwiki(1, 1) + + AssertEqual 'TodoDate', GetSyntaxVimwiki(2, 1) + AssertEqual 'TodoDate', GetSyntaxVimwiki(3, 1) + AssertEqual 'TodoDueDate', GetSyntaxVimwiki(4, 1) + + AssertEqual 'TodoProject', GetSyntaxVimwiki(6, 1) + AssertEqual 'normal', GetSyntaxVimwiki(6, 15) + AssertEqual 'TodoContext', GetSyntaxVimwiki(7, 1) + AssertEqual 'normal', GetSyntaxVimwiki(7, 15) + + AssertEqual 'normal', GetSyntaxVimwiki(9, 1) + AssertEqual 'TodoProject', GetSyntaxVimwiki(9, 10) + AssertEqual 'normal', GetSyntaxVimwiki(9, 20) + AssertEqual 'normal', GetSyntaxVimwiki(10, 1) + AssertEqual 'TodoContext', GetSyntaxVimwiki(10, 10) + AssertEqual 'normal', GetSyntaxVimwiki(10, 20) diff --git a/test/issue_example.vader b/test/issue_example.vader new file mode 100644 index 0000000..68b819a --- /dev/null +++ b/test/issue_example.vader @@ -0,0 +1,16 @@ +# Non regression tests for issue TODO +# -- TODO copy-paste issue description +# +# Syntax: https://github.com/junegunn/vader.vim#syntax-of-vader-file +# Run: bash run_tests.sh -v -t vader -n vim_7.3.429 -f issue_example.vader + +Given vimwiki (Input file): + test + +Execute (Call function to verify): + echo 'Dummy command, not displayed' + Log 'Debug message displayed in Vader output' + AssertEqual 'test', getline(1), 'Dummy assertion' + +Expect (Output file): + test diff --git a/test/vimrc b/test/vimrc index d24fb55..580185e 100644 --- a/test/vimrc +++ b/test/vimrc @@ -343,6 +343,14 @@ 0d endfunction + function! GetSyntaxVimwiki(line, col) + let res = GetSyntaxStack(a:line, a:col) + if empty(res) + return 'normal' + endif + return res[0] + endfunction + function! GetSyntaxGroup(...) " Get normalized syntax group: usefull for boldItalic Vs italicBold " Arg1: line