Mercurial > vim
diff src/testdir/test_join.vim @ 17172:6990c1160ea5 v8.1.1585
patch 8.1.1585: :let-heredoc does not trim enough
commit https://github.com/vim/vim/commit/e7eb92708ec2092a2fc11e78703b5dcf83844412
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Jun 24 00:58:07 2019 +0200
patch 8.1.1585: :let-heredoc does not trim enough
Problem: :let-heredoc does not trim enough.
Solution: Trim indent from the contents based on the indent of the first
line. Use let-heredoc in more tests.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 24 Jun 2019 01:00:05 +0200 |
parents | 9c90cf08cfa8 |
children | 9cbdd58eeeb2 |
line wrap: on
line diff
--- a/src/testdir/test_join.vim +++ b/src/testdir/test_join.vim @@ -100,22 +100,22 @@ ert " Expected output let expected =<< trim [DATA] - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - zx cvn. as dfg? hjkl iop! ert ernop - zx cvn. as dfg? hjkl iop! ert ernop + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + zx cvn. as dfg? hjkl iop! ert ernop + zx cvn. as dfg? hjkl iop! ert ernop [DATA] call assert_equal(expected, getline(1, '$')) @@ -142,22 +142,22 @@ ert " Expected output let expected =<< trim [DATA] - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - zx cvn. as dfg? hjkl iop! ert enop - zx cvn. as dfg? hjkl iop! ert ernop + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + zx cvn. as dfg? hjkl iop! ert enop + zx cvn. as dfg? hjkl iop! ert ernop [DATA] @@ -176,21 +176,21 @@ ert " Expected output let expected =<< trim [DATA] - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf. asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - asdfasdf asdf - zx cvn. as dfg? hjkl iop! ert a + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf. asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + asdfasdf asdf + zx cvn. as dfg? hjkl iop! ert a [DATA] call assert_equal(expected, getline(1, '$')) @@ -255,18 +255,18 @@ action(); " Expected output let expected =<< trim [CODE] -{ -/* Make sure the previous comment leader is not removed. */ -/* Make sure the previous comment leader is not removed. */ -// Should the next comment leader be left alone? Yes. -// Should the next comment leader be left alone? Yes. -/* Here the comment leader should be left intact. */ // And so should this one. -/* Here the comment leader should be left intact. */ // And so should this one. -if (condition) // Remove the next comment leader! OK, I will. -action(); -if (condition) // Remove the next comment leader! OK, I will. -action(); -} + { + /* Make sure the previous comment leader is not removed. */ + /* Make sure the previous comment leader is not removed. */ + // Should the next comment leader be left alone? Yes. + // Should the next comment leader be left alone? Yes. + /* Here the comment leader should be left intact. */ // And so should this one. + /* Here the comment leader should be left intact. */ // And so should this one. + if (condition) // Remove the next comment leader! OK, I will. + action(); + if (condition) // Remove the next comment leader! OK, I will. + action(); + } [CODE] call assert_equal(expected, getline(1, '$')) @@ -378,30 +378,30 @@ int i = 7 /* foo *// 3 exe "normal oSome code!\<CR>// Make sure backspacing does not remove this comment leader.\<Esc>0i\<C-H>\<Esc>" " Expected output - let expected =<< [CODE] -{ -/* Make sure the previous comment leader is not removed. */ -/* Make sure the previous comment leader is not removed. */ -/* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ -/* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ -// Should the next comment leader be left alone? Yes. -// Should the next comment leader be left alone? Yes. -/* Here the comment leader should be left intact. */ // And so should this one. -/* Here the comment leader should be left intact. */ // And so should this one. -if (condition) // Remove the next comment leader! OK, I will. - action(); -if (condition) // Remove the next comment leader! OK, I will. - action(); -int i = 7 /* foo *// 3 // comment - ; -int i = 7 /* foo *// 3 // comment - ; -># Note that the last character of the ending comment leader (left angle bracket) is a comment leader itself. Make sure that this comment leader is not removed from the next line #< < On this line a new comment is opened which spans 2 lines. This comment should retain its comment leader. -># Note that the last character of the ending comment leader (left angle bracket) is a comment leader itself. Make sure that this comment leader is not removed from the next line #< < On this line a new comment is opened which spans 2 lines. This comment should retain its comment leader. - -Some code!// Make sure backspacing does not remove this comment leader. -} -[CODE] + let expected =<< trim [CODE] + { + /* Make sure the previous comment leader is not removed. */ + /* Make sure the previous comment leader is not removed. */ + /* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ + /* List: item1 foo bar baz foo bar baz item2 foo bar baz foo bar baz */ + // Should the next comment leader be left alone? Yes. + // Should the next comment leader be left alone? Yes. + /* Here the comment leader should be left intact. */ // And so should this one. + /* Here the comment leader should be left intact. */ // And so should this one. + if (condition) // Remove the next comment leader! OK, I will. + action(); + if (condition) // Remove the next comment leader! OK, I will. + action(); + int i = 7 /* foo *// 3 // comment + ; + int i = 7 /* foo *// 3 // comment + ; + ># Note that the last character of the ending comment leader (left angle bracket) is a comment leader itself. Make sure that this comment leader is not removed from the next line #< < On this line a new comment is opened which spans 2 lines. This comment should retain its comment leader. + ># Note that the last character of the ending comment leader (left angle bracket) is a comment leader itself. Make sure that this comment leader is not removed from the next line #< < On this line a new comment is opened which spans 2 lines. This comment should retain its comment leader. + + Some code!// Make sure backspacing does not remove this comment leader. + } + [CODE] call assert_equal(expected, getline(1, '$')) close!