diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-08-31 21:17:10 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-08-31 21:17:10 +0100 |
commit | 5d09a401ec393dc930e1104ceb38eab34681de64 (patch) | |
tree | 2b9f540edb9197ecaf64fd308cd35c354a65bf45 /src/testdir/test_gui.vim | |
parent | 21c3a80a7fd6b7fc250ce5dc287963511f54b86f (diff) |
patch 9.0.0343: ColorScheme autocommand triggered when colorscheme not foundv9.0.0343
Problem: ColorScheme autocommand triggered when colorscheme is not found.
(Romain Lafourcade)
Solution: Only trigger ColorScheme when loading the colorscheme succeeds.
(closes #11024)
Diffstat (limited to 'src/testdir/test_gui.vim')
-rw-r--r-- | src/testdir/test_gui.vim | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/testdir/test_gui.vim b/src/testdir/test_gui.vim index ed40c256cb..afac5ccb99 100644 --- a/src/testdir/test_gui.vim +++ b/src/testdir/test_gui.vim @@ -36,8 +36,12 @@ func Test_colorscheme() let g:color_count = 0 augroup TestColors au! - au ColorScheme * let g:color_count += 1| let g:after_colors = g:color_count - au ColorSchemePre * let g:color_count += 1 |let g:before_colors = g:color_count + au ColorScheme * let g:color_count += 1 + \ | let g:after_colors = g:color_count + \ | let g:color_after = expand('<amatch>') + au ColorSchemePre * let g:color_count += 1 + \ | let g:before_colors = g:color_count + \ | let g:color_pre = expand('<amatch>') augroup END colorscheme torte @@ -45,6 +49,8 @@ func Test_colorscheme() call assert_equal('dark', &background) call assert_equal(1, g:before_colors) call assert_equal(2, g:after_colors) + call assert_equal('torte', g:color_pre) + call assert_equal('torte', g:color_after) call assert_equal("\ntorte", execute('colorscheme')) let a = substitute(execute('hi Search'), "\n\\s\\+", ' ', 'g') @@ -53,6 +59,8 @@ func Test_colorscheme() call assert_match("\nSearch xxx term=reverse ", a) call assert_fails('colorscheme does_not_exist', 'E185:') + call assert_equal('does_not_exist', g:color_pre) + call assert_equal('torte', g:color_after) exec 'colorscheme' colorscheme_saved augroup TestColors |