diff options
author | ZviRackover <zvirack@gmail.com> | 2018-07-10 21:46:40 +0300 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2018-07-10 20:46:40 +0200 |
commit | 627cc1b3d8d7fa6dc09f2f48fd5e3567f85d46cd (patch) | |
tree | a78e02d2e138ab1c9b707003d4f604ba8fdab43e /test/unit/buffer_spec.lua | |
parent | 2574f299e55b85cb9294cedfccda35ad9b2aec21 (diff) | |
download | rneovim-627cc1b3d8d7fa6dc09f2f48fd5e3567f85d46cd.tar.gz rneovim-627cc1b3d8d7fa6dc09f2f48fd5e3567f85d46cd.tar.bz2 rneovim-627cc1b3d8d7fa6dc09f2f48fd5e3567f85d46cd.zip |
test: build_stl_str_hl (#8703)
Improve coverage of `build_stl_str_hl`.
Minor removal of dead code in the tested function.
Diffstat (limited to 'test/unit/buffer_spec.lua')
-rw-r--r-- | test/unit/buffer_spec.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/unit/buffer_spec.lua b/test/unit/buffer_spec.lua index f7124b2782..bf4e5a0e6d 100644 --- a/test/unit/buffer_spec.lua +++ b/test/unit/buffer_spec.lua @@ -282,6 +282,12 @@ describe('buffer functions', function() end) end + -- expression testing + statusline_test('Should expand expression', 2, + '%!expand(20+1)', '21') + statusline_test('Should expand broken expression to itself', 11, + '%!expand(20+1', 'expand(20+1') + -- file name testing statusline_test('should print no file name', 10, '%f', '[No Name]', @@ -306,6 +312,12 @@ describe('buffer functions', function() statusline_test('should put fillchar `~` in between text', 10, 'abc%=def', 'abc~~~~def', {fillchar=('~'):byte()}) + statusline_test('should handle zero-fillchar as a space', 10, + 'abcde%=', 'abcde ', + {fillchar=0}) + statusline_test('should handle multibyte-fillchar as a dash', 10, + 'abcde%=', 'abcde-----', + {fillchar=0x80}) statusline_test('should print the tail file name', 80, '%t', 'buffer_spec.lua', {file_name='test/unit/buffer_spec.lua', expected_cell_count=15}) @@ -352,6 +364,8 @@ describe('buffer functions', function() statusline_test('should truncate at the first `<`', 10, 'abc%<def%<ghijklm', 'abc<hijklm') + statusline_test('should ignore trailing %', 3, 'abc%', 'abc') + -- alignment testing statusline_test('should right align when using =', 20, 'neo%=vim', 'neo vim') @@ -452,5 +466,10 @@ describe('buffer functions', function() 'Ą%=mid%=end', 'Ą@mid@@end', {fillchar=('@'):byte(), expected_byte_length=11}) + -- escaping % testing + statusline_test('should handle escape of %', 4, 'abc%%', 'abc%') + statusline_test('case where escaped % does not fit', 3, 'abc%%abcabc', '<bc') + statusline_test('escaped % is first', 1, '%%', '%') + end) end) |