X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/1413c2cc27fb062758c57205c2796609ace75e29..fc679c4c0fd36b93ce0cc3e88348df9b35b6a43b:/test/python-folding.vader diff --git a/test/python-folding.vader b/test/python-folding.vader index 43f8085..ca40c62 100644 --- a/test/python-folding.vader +++ b/test/python-folding.vader @@ -29,21 +29,25 @@ Execute (fold level # in code block): AssertEqual foldlevel(12), 1, 'foobar' Execute (fold text of chapters): - AssertEqual foldtextresult(3), '## Chapter 1 ' . repeat('-', winwidth(0) - 18) . ' 6' - AssertEqual foldtextresult(10), '## Chapter 2 ' . repeat('-', winwidth(0) - 18) . ' 2' + let b:width = winwidth(0) + let b:hyphen = repeat('-', b:width - 18 > 2 ? b:width - 18 : b:width - 9 > 0 ? 3 : 2) + AssertEqual foldtextresult(3), strpart('## Chapter 1', 0, b:width - 9) . ' ' . b:hyphen . ' 6' + AssertEqual foldtextresult(10), strpart('## Chapter 2', 0, b:width - 9) . ' ' . b:hyphen . ' 2' Given markdown; Fold text 1 -==+ Fold Level 1 +=========== Fold text 2 ---+ Fold Level 2 +----------- -Execute (fold level ==+, --+): - AssertEqual foldlevel(2), 0, '==+' - AssertEqual foldlevel(4), 1, '--+' +Execute (fold level ==, --): + AssertEqual foldlevel(2), 0, '==' + AssertEqual foldlevel(4), 1, '--' -Execute (fold text of ==+, --+): - AssertEqual foldtextresult(3), 'Fold text 2 ' . repeat('-', winwidth(0) - 17) . ' 1' +Execute (fold text of ==, --): + let b:width = winwidth(0) + let b:hyphen = repeat('-', b:width - 17 > 2 ? b:width - 17 : b:width - 9 > 0 ? 3 : 2) + AssertEqual foldtextresult(3), strpart('Fold text 2', 0, b:width - 9) . ' ' . b:hyphen . ' 1' Given markdown; Headline