Mercurial > vim
comparison src/testdir/test_breakindent.vim @ 29340:fba9e366ced4 v9.0.0013
patch 9.0.0013: reproducing memory access errors can be difficult
Commit: https://github.com/vim/vim/commit/fa4873ccfc10e0f278dc46f39d00136fab059b19
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 30 22:13:59 2022 +0100
patch 9.0.0013: reproducing memory access errors can be difficult
Problem: Reproducing memory access errors can be difficult.
Solution: When testing, copy each line to allocated memory, so that valgrind
can detect accessing memory before and/or after it. Fix uncovered
problems.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 30 Jun 2022 23:15:03 +0200 |
parents | 2bd5cb054180 |
children | 336c99d14cc5 |
comparison
equal
deleted
inserted
replaced
29339:a023e3008ae3 | 29340:fba9e366ced4 |
---|---|
8 CheckOption breakindent | 8 CheckOption breakindent |
9 | 9 |
10 source view_util.vim | 10 source view_util.vim |
11 source screendump.vim | 11 source screendump.vim |
12 | 12 |
13 let s:input ="\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP" | 13 func SetUp() |
14 let s:input ="\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP" | |
15 endfunc | |
14 | 16 |
15 func s:screen_lines(lnum, width) abort | 17 func s:screen_lines(lnum, width) abort |
16 return ScreenLines([a:lnum, a:lnum + 2], a:width) | 18 return ScreenLines([a:lnum, a:lnum + 2], a:width) |
17 endfunc | 19 endfunc |
18 | 20 |
712 | 714 |
713 call s:close_windows('set breakindent& briopt& cpo& number&') | 715 call s:close_windows('set breakindent& briopt& cpo& number&') |
714 endfunc | 716 endfunc |
715 | 717 |
716 func Test_breakindent20_list() | 718 func Test_breakindent20_list() |
719 " FIXME - this should not matter | |
720 call test_override('alloc_lines', 0) | |
721 | |
717 call s:test_windows('setl breakindent breakindentopt= linebreak') | 722 call s:test_windows('setl breakindent breakindentopt= linebreak') |
718 " default: | 723 " default: |
719 call setline(1, [' 1. Congress shall make no law', | 724 call setline(1, [' 1. Congress shall make no law', |
720 \ ' 2.) Congress shall make no law', | 725 \ ' 2.) Congress shall make no law', |
721 \ ' 3.] Congress shall make no law']) | 726 \ ' 3.] Congress shall make no law']) |
828 \ "> make no law ", | 833 \ "> make no law ", |
829 \ ] | 834 \ ] |
830 let lines = s:screen_lines2(1, 6, 20) | 835 let lines = s:screen_lines2(1, 6, 20) |
831 call s:compare_lines(expect, lines) | 836 call s:compare_lines(expect, lines) |
832 call s:close_windows('set breakindent& briopt& linebreak& list& listchars& showbreak&') | 837 call s:close_windows('set breakindent& briopt& linebreak& list& listchars& showbreak&') |
838 | |
839 " FIXME - this should not matter | |
840 call test_override('alloc_lines', 1) | |
833 endfunc | 841 endfunc |
834 | 842 |
835 " The following used to crash Vim. This is fixed by 8.2.3391. | 843 " The following used to crash Vim. This is fixed by 8.2.3391. |
836 " This is a regression introduced by 8.2.2903. | 844 " This is a regression introduced by 8.2.2903. |
837 func Test_window_resize_with_linebreak() | 845 func Test_window_resize_with_linebreak() |
871 call StopVimInTerminal(buf) | 879 call StopVimInTerminal(buf) |
872 call delete('XscriptShowbreak') | 880 call delete('XscriptShowbreak') |
873 endfunc | 881 endfunc |
874 | 882 |
875 func Test_no_spurious_match() | 883 func Test_no_spurious_match() |
884 " FIXME - fails under valgrind - this should not matter - timing issue? | |
885 call test_override('alloc_lines', 0) | |
886 | |
876 let s:input = printf('- y %s y %s', repeat('x', 50), repeat('x', 50)) | 887 let s:input = printf('- y %s y %s', repeat('x', 50), repeat('x', 50)) |
877 call s:test_windows('setl breakindent breakindentopt=list:-1 formatlistpat=^- hls') | 888 call s:test_windows('setl breakindent breakindentopt=list:-1 formatlistpat=^- hls') |
878 let @/ = '\%>3v[y]' | 889 let @/ = '\%>3v[y]' |
879 redraw! | 890 redraw! |
880 call searchcount().total->assert_equal(1) | 891 call searchcount().total->assert_equal(1) |
892 | |
881 " cleanup | 893 " cleanup |
882 set hls&vim | 894 set hls&vim |
883 let s:input = "\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP" | |
884 bwipeout! | 895 bwipeout! |
896 " FIXME - this should not matter | |
897 call test_override('alloc_lines', 1) | |
885 endfunc | 898 endfunc |
886 | 899 |
887 func Test_no_extra_indent() | 900 func Test_no_extra_indent() |
888 call s:test_windows('setl breakindent breakindentopt=list:-1,min:10') | 901 call s:test_windows('setl breakindent breakindentopt=list:-1,min:10') |
889 %d | 902 %d |
943 call s:compare_lines(expect, lines) | 956 call s:compare_lines(expect, lines) |
944 bwipeout! | 957 bwipeout! |
945 endfunc | 958 endfunc |
946 | 959 |
947 func Test_breakindent_column() | 960 func Test_breakindent_column() |
948 " restore original | |
949 let s:input ="\tabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP" | |
950 call s:test_windows('setl breakindent breakindentopt=column:10') | 961 call s:test_windows('setl breakindent breakindentopt=column:10') |
951 redraw! | 962 redraw! |
952 " 1) default: does not indent, too wide :( | 963 " 1) default: does not indent, too wide :( |
953 let expect = [ | 964 let expect = [ |
954 \ " ", | 965 \ " ", |