Mercurial > vim
comparison src/testdir/test_normal.vim @ 20832:045442aa392b v8.2.0968
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Commit: https://github.com/vim/vim/commit/c9630d2658af9dcaa01913e899b201bfdef7b536
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 13 13:20:48 2020 +0200
patch 8.2.0968: no proper testing of the 'cpoptions' flags
Problem: No proper testing of the 'cpoptions' flags.
Solution: Add tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/6251)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 13 Jun 2020 13:30:04 +0200 |
parents | aafedd368f40 |
children | d3fa0d29fa9a |
comparison
equal
deleted
inserted
replaced
20831:415f3c972a53 | 20832:045442aa392b |
---|---|
2529 " cleanup | 2529 " cleanup |
2530 set norl | 2530 set norl |
2531 bw! | 2531 bw! |
2532 endfunc | 2532 endfunc |
2533 | 2533 |
2534 func Test_normal53_digraph() | |
2535 CheckFeature digraphs | |
2536 new | |
2537 call setline(1, 'abcdefgh|') | |
2538 exe "norm! 1gg0f\<c-k>!!" | |
2539 call assert_equal(9, col('.')) | |
2540 set cpo+=D | |
2541 exe "norm! 1gg0f\<c-k>!!" | |
2542 call assert_equal(1, col('.')) | |
2543 | |
2544 set cpo-=D | |
2545 bw! | |
2546 endfunc | |
2547 | |
2548 func Test_normal54_Ctrl_bsl() | 2534 func Test_normal54_Ctrl_bsl() |
2549 new | 2535 new |
2550 call setline(1, 'abcdefghijklmn') | 2536 call setline(1, 'abcdefghijklmn') |
2551 exe "norm! df\<c-\>\<c-n>" | 2537 exe "norm! df\<c-\>\<c-n>" |
2552 call assert_equal(['abcdefghijklmn'], getline(1,'$')) | 2538 call assert_equal(['abcdefghijklmn'], getline(1,'$')) |
2864 call assert_equal([3, 76], [line('.'), col('.')]) | 2850 call assert_equal([3, 76], [line('.'), col('.')]) |
2865 %bw! | 2851 %bw! |
2866 set cpoptions& number& numberwidth& wrap& | 2852 set cpoptions& number& numberwidth& wrap& |
2867 endfunc | 2853 endfunc |
2868 | 2854 |
2869 " Test for cursor movement with '-' in 'cpoptions' | |
2870 func Test_normal_cpo_minus() | |
2871 new | |
2872 call setline(1, ['foo', 'bar', 'baz']) | |
2873 let save_cpo = &cpo | |
2874 set cpo+=- | |
2875 call assert_beeps('normal 10j') | |
2876 call assert_equal(1, line('.')) | |
2877 normal G | |
2878 call assert_beeps('normal 10k') | |
2879 call assert_equal(3, line('.')) | |
2880 call assert_fails(10, 'E16:') | |
2881 let &cpo = save_cpo | |
2882 close! | |
2883 endfunc | |
2884 | |
2885 " Test for displaying dollar when changing text ('$' flag in 'cpoptions') | |
2886 func Test_normal_cpo_dollar() | |
2887 new | |
2888 let g:Line = '' | |
2889 func SaveFirstLine() | |
2890 let g:Line = Screenline(1) | |
2891 return '' | |
2892 endfunc | |
2893 inoremap <expr> <buffer> <F2> SaveFirstLine() | |
2894 call test_override('redraw_flag', 1) | |
2895 set cpo+=$ | |
2896 call setline(1, 'one two three') | |
2897 redraw! | |
2898 exe "normal c2w\<F2>vim" | |
2899 call assert_equal('one tw$ three', g:Line) | |
2900 call assert_equal('vim three', getline(1)) | |
2901 set cpo-=$ | |
2902 call test_override('ALL', 0) | |
2903 delfunc SaveFirstLine | |
2904 %bw! | |
2905 endfunc | |
2906 | |
2907 " Test for using : to run a multi-line Ex command in operator pending mode | 2855 " Test for using : to run a multi-line Ex command in operator pending mode |
2908 func Test_normal_yank_with_excmd() | 2856 func Test_normal_yank_with_excmd() |
2909 new | 2857 new |
2910 call setline(1, ['foo', 'bar', 'baz']) | 2858 call setline(1, ['foo', 'bar', 'baz']) |
2911 let @a = '' | 2859 let @a = '' |
2980 call assert_equal('', getline(1)) | 2928 call assert_equal('', getline(1)) |
2981 set virtualedit& | 2929 set virtualedit& |
2982 " delete to a readonly register | 2930 " delete to a readonly register |
2983 call setline(1, ['abcd']) | 2931 call setline(1, ['abcd']) |
2984 call assert_beeps('normal ":d2l') | 2932 call assert_beeps('normal ":d2l') |
2985 close! | |
2986 endfunc | |
2987 | |
2988 " Test for the 'E' flag in 'cpo' with yank, change, delete, etc. operators | |
2989 func Test_empty_region_error() | |
2990 new | |
2991 call setline(1, '') | |
2992 set cpo+=E | |
2993 " yank an empty line | |
2994 call assert_beeps('normal "ayl') | |
2995 " change an empty line | |
2996 call assert_beeps('normal lcTa') | |
2997 " delete an empty line | |
2998 call assert_beeps('normal D') | |
2999 call assert_beeps('normal dl') | |
3000 call assert_equal('', getline(1)) | |
3001 " change case of an empty line | |
3002 call assert_beeps('normal gul') | |
3003 call assert_beeps('normal gUl') | |
3004 " replace a character | |
3005 call assert_beeps('normal vrx') | |
3006 " increment and decrement | |
3007 call assert_beeps('exe "normal v\<C-A>"') | |
3008 call assert_beeps('exe "normal v\<C-X>"') | |
3009 set cpo-=E | |
3010 close! | 2933 close! |
3011 endfunc | 2934 endfunc |
3012 | 2935 |
3013 " Test for 'w' and 'b' commands | 2936 " Test for 'w' and 'b' commands |
3014 func Test_normal_word_move() | 2937 func Test_normal_word_move() |