aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_syntax.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-10-26 22:38:47 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-10-27 00:14:02 +0800
commit5559cabf4d851edb94cc2f09d50bcf0a04bd0819 (patch)
tree72b4793f802b2c611cb0b870fcbb20f26ea85923 /src/nvim/testdir/test_syntax.vim
parenta8d454816ad14e05578d37d1e16c34d8207fde19 (diff)
downloadrneovim-5559cabf4d851edb94cc2f09d50bcf0a04bd0819.tar.gz
rneovim-5559cabf4d851edb94cc2f09d50bcf0a04bd0819.tar.bz2
rneovim-5559cabf4d851edb94cc2f09d50bcf0a04bd0819.zip
vim-patch:8.2.0531: various errors not tested
Problem: Various errors not tested. Solution: Add tests. (Yegappan Lakshmanan, closes vim/vim#5895) https://github.com/vim/vim/commit/476a613135bdc94e61c1dce8a9cbb4ab0b6dc2d1 Need to remove "F" flag from 'shortmess' as early as possible.
Diffstat (limited to 'src/nvim/testdir/test_syntax.vim')
-rw-r--r--src/nvim/testdir/test_syntax.vim58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_syntax.vim b/src/nvim/testdir/test_syntax.vim
index 1402f0b9ad..52510843a3 100644
--- a/src/nvim/testdir/test_syntax.vim
+++ b/src/nvim/testdir/test_syntax.vim
@@ -363,6 +363,64 @@ func Test_syntax_invalid_arg()
call assert_fails('syntax sync x', 'E404:')
call assert_fails('syntax keyword Abc a[', 'E789:')
call assert_fails('syntax keyword Abc a[bc]d', 'E890:')
+
+ let caught_393 = 0
+ try
+ syntax keyword cMyItem grouphere G1
+ catch /E393:/
+ let caught_393 = 1
+ endtry
+ call assert_equal(1, caught_393)
+
+ let caught_394 = 0
+ try
+ syntax sync match Abc grouphere MyItem "abc"'
+ catch /E394:/
+ let caught_394 = 1
+ endtry
+ call assert_equal(1, caught_394)
+
+ " Test for too many \z\( and unmatched \z\(
+ " Not able to use assert_fails() here because both E50:/E879: and E475:
+ " messages are emitted.
+ set regexpengine=1
+ let caught_52 = 0
+ try
+ syntax region MyRegion start='\z\(' end='\*/'
+ catch /E52:/
+ let caught_52 = 1
+ endtry
+ call assert_equal(1, caught_52)
+
+ let caught_50 = 0
+ try
+ let cmd = "syntax region MyRegion start='"
+ let cmd ..= repeat("\\z\\(.\\)", 10) .. "' end='\*/'"
+ exe cmd
+ catch /E50:/
+ let caught_50 = 1
+ endtry
+ call assert_equal(1, caught_50)
+
+ set regexpengine=2
+ let caught_54 = 0
+ try
+ syntax region MyRegion start='\z\(' end='\*/'
+ catch /E54:/
+ let caught_54 = 1
+ endtry
+ call assert_equal(1, caught_54)
+
+ let caught_879 = 0
+ try
+ let cmd = "syntax region MyRegion start='"
+ let cmd ..= repeat("\\z\\(.\\)", 10) .. "' end='\*/'"
+ exe cmd
+ catch /E879:/
+ let caught_879 = 1
+ endtry
+ call assert_equal(1, caught_879)
+ set regexpengine&
endfunc
func Test_syn_sync()