From c79745a82faeb5a6058e915ca49a4c69fa60ea01 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 20 May 2019 22:12:34 +0200 Subject: patch 8.1.1362: code and data in tests can be hard to read Problem: Code and data in tests can be hard to read. Solution: Use the new heredoc style. (Yegappan Lakshmanan, closes #4400) --- src/testdir/test_conceal.vim | 50 ++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'src/testdir/test_conceal.vim') diff --git a/src/testdir/test_conceal.vim b/src/testdir/test_conceal.vim index 685c89175..66384e1c1 100644 --- a/src/testdir/test_conceal.vim +++ b/src/testdir/test_conceal.vim @@ -11,21 +11,23 @@ if !CanRunVimInTerminal() endif func Test_conceal_two_windows() - call writefile([ - \ 'let lines = ["one one one one one", "two |hidden| here", "three |hidden| three"]', - \ 'call setline(1, lines)', - \ 'syntax match test /|hidden|/ conceal', - \ 'set conceallevel=2', - \ 'set concealcursor=', - \ 'exe "normal /here\r"', - \ 'new', - \ 'call setline(1, lines)', - \ 'call setline(4, "Second window")', - \ 'syntax match test /|hidden|/ conceal', - \ 'set conceallevel=2', - \ 'set concealcursor=nc', - \ 'exe "normal /here\r"', - \ ], 'XTest_conceal') + let code =<< trim [CODE] + let lines = ["one one one one one", "two |hidden| here", "three |hidden| three"] + call setline(1, lines) + syntax match test /|hidden|/ conceal + set conceallevel=2 + set concealcursor= + exe "normal /here\r" + new + call setline(1, lines) + call setline(4, "Second window") + syntax match test /|hidden|/ conceal + set conceallevel=2 + set concealcursor=nc + exe "normal /here\r" + [CODE] + + call writefile(code, 'XTest_conceal') " Check that cursor line is concealed let buf = RunVimInTerminal('-S XTest_conceal', {}) call VerifyScreenDump(buf, 'Test_conceal_two_windows_01', {}) @@ -113,14 +115,16 @@ endfunc func Test_conceal_with_cursorline() " Opens a help window, where 'conceal' is set, switches to the other window " where 'cursorline' needs to be updated when the cursor moves. - call writefile([ - \ 'set cursorline', - \ 'normal othis is a test', - \ 'new', - \ 'call setline(1, ["one", "two", "three", "four", "five"])', - \ 'set ft=help', - \ 'normal M', - \ ], 'XTest_conceal_cul') + let code =<< trim [CODE] + set cursorline + normal othis is a test + new + call setline(1, ["one", "two", "three", "four", "five"]) + set ft=help + normal M + [CODE] + + call writefile(code, 'XTest_conceal_cul') let buf = RunVimInTerminal('-S XTest_conceal_cul', {}) call VerifyScreenDump(buf, 'Test_conceal_cul_01', {}) -- cgit v1.2.1