comparison src/testdir/test_options.vim @ 25238:dd98794f7d8c v8.2.3155

patch 8.2.3155: some option related code not covered by tests Commit: https://github.com/vim/vim/commit/042414fa0053388f9a35cad61886405507554068 Author: Dominique Pelle <dominique.pelle@gmail.com> Date: Mon Jul 12 21:43:19 2021 +0200 patch 8.2.3155: some option related code not covered by tests Problem: Some option related code not covered by tests. Solution: Add a few test cases. (Dominique Pell?, closes https://github.com/vim/vim/issues/8552)
author Bram Moolenaar <Bram@vim.org>
date Mon, 12 Jul 2021 21:45:06 +0200
parents 82ae6fcd86c8
children 7b2e2b9617ee
comparison
equal deleted inserted replaced
25237:416d488ca356 25238:dd98794f7d8c
929 setglobal noautoread 929 setglobal noautoread
930 setlocal autoread 930 setlocal autoread
931 setlocal autoread< 931 setlocal autoread<
932 call assert_false(&autoread) 932 call assert_false(&autoread)
933 set autoread& 933 set autoread&
934 endfunc
935
936 func Test_set_in_sandbox()
937 " Some boolean options cannot be set in sandbox, some can.
938 call assert_fails('sandbox set modelineexpr', 'E48:')
939 sandbox set number
940 call assert_true(&number)
941 set number&
942
943 " Some boolean options cannot be set in sandbox, some can.
944 if has('python') || has('python3')
945 call assert_fails('sandbox set pyxversion=3', 'E48:')
946 endif
947 sandbox set tabstop=4
948 call assert_equal(4, &tabstop)
949 set tabstop&
950
951 " Some string options cannot be set in sandbox, some can.
952 call assert_fails('sandbox set backupdir=/tmp', 'E48:')
953 sandbox set filetype=perl
954 call assert_equal('perl', &filetype)
955 set filetype&
934 endfunc 956 endfunc
935 957
936 " Test for incrementing, decrementing and multiplying a number option value 958 " Test for incrementing, decrementing and multiplying a number option value
937 func Test_opt_num_op() 959 func Test_opt_num_op()
938 set shiftwidth=4 960 set shiftwidth=4
1147 set errorbells 1169 set errorbells
1148 call assert_beeps('s/a1b2/x1y2/') 1170 call assert_beeps('s/a1b2/x1y2/')
1149 set noerrorbells 1171 set noerrorbells
1150 endfunc 1172 endfunc
1151 1173
1174 func Test_opt_scrolljump()
1175 help
1176 resize 10
1177
1178 " Test with positive 'scrolljump'.
1179 set scrolljump=2
1180 norm! Lj
1181 call assert_equal({'lnum':11, 'leftcol':0, 'col':0, 'topfill':0,
1182 \ 'topline':3, 'coladd':0, 'skipcol':0, 'curswant':0},
1183 \ winsaveview())
1184
1185 " Test with negative 'scrolljump' (percentage of window height).
1186 set scrolljump=-40
1187 norm! ggLj
1188 call assert_equal({'lnum':11, 'leftcol':0, 'col':0, 'topfill':0,
1189 \ 'topline':5, 'coladd':0, 'skipcol':0, 'curswant':0},
1190 \ winsaveview())
1191
1192 set scrolljump&
1193 bw
1194 endfunc
1195
1152 " vim: shiftwidth=2 sts=2 expandtab 1196 " vim: shiftwidth=2 sts=2 expandtab