diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/legacy/eval_spec.lua | 18 | ||||
-rw-r--r-- | test/functional/viml/completion_spec.lua | 12 | ||||
-rw-r--r-- | test/unit/buffer_spec.lua | 10 |
3 files changed, 35 insertions, 5 deletions
diff --git a/test/functional/legacy/eval_spec.lua b/test/functional/legacy/eval_spec.lua index e0a4e10746..d1ed96cc2e 100644 --- a/test/functional/legacy/eval_spec.lua +++ b/test/functional/legacy/eval_spec.lua @@ -693,4 +693,22 @@ describe('eval', function() start: 6]]) end) + + it('substring and variable name', function() + execute("let str = 'abcdef'") + execute('let n = 3') + eq('def', eval('str[n:]')) + eq('abcd', eval('str[:n]')) + eq('d', eval('str[n:n]')) + execute('unlet n') + execute('let nn = 3') + eq('def', eval('str[nn:]')) + eq('abcd', eval('str[:nn]')) + eq('d', eval('str[nn:nn]')) + execute('unlet nn') + execute('let b:nn = 4') + eq('ef', eval('str[b:nn:]')) + eq('abcde', eval('str[:b:nn]')) + eq('e', eval('str[b:nn:b:nn]')) + end) end) diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua index 20eee24524..01b2bad059 100644 --- a/test/functional/viml/completion_spec.lua +++ b/test/functional/viml/completion_spec.lua @@ -100,6 +100,18 @@ describe('completion', function() feed('o<C-r>=TestComplete()<CR><ESC>') eq('', eval('getline(3)')) end) + it('does not change modified state if noinsert', function() + execute('set completeopt+=menuone,noinsert') + execute('setlocal nomodified') + feed('i<C-r>=TestComplete()<CR><ESC>') + eq(0, eval('&l:modified')) + end) + it('does not change modified state if noselect', function() + execute('set completeopt+=menuone,noselect') + execute('setlocal nomodified') + feed('i<C-r>=TestComplete()<CR><ESC>') + eq(0, eval('&l:modified')) + end) end) describe("refresh:always", function() diff --git a/test/unit/buffer_spec.lua b/test/unit/buffer_spec.lua index a2e7bd91af..b7f82064d7 100644 --- a/test/unit/buffer_spec.lua +++ b/test/unit/buffer_spec.lua @@ -41,13 +41,13 @@ describe('buffer functions', function() describe('buf_valid', function() it('should view NULL as an invalid buffer', function() - eq(0, buffer.buf_valid(NULL)) + eq(false, buffer.buf_valid(NULL)) end) it('should view an open buffer as valid', function() local buf = buflist_new(path1, buffer.BLN_LISTED) - eq(1, buffer.buf_valid(buf)) + eq(true, buffer.buf_valid(buf)) end) it('should view a closed and hidden buffer as valid', function() @@ -55,7 +55,7 @@ describe('buffer functions', function() close_buffer(NULL, buf, 0, 0) - eq(1, buffer.buf_valid(buf)) + eq(true, buffer.buf_valid(buf)) end) it('should view a closed and unloaded buffer as valid', function() @@ -63,7 +63,7 @@ describe('buffer functions', function() close_buffer(NULL, buf, buffer.DOBUF_UNLOAD, 0) - eq(1, buffer.buf_valid(buf)) + eq(true, buffer.buf_valid(buf)) end) it('should view a closed and wiped buffer as invalid', function() @@ -71,7 +71,7 @@ describe('buffer functions', function() close_buffer(NULL, buf, buffer.DOBUF_WIPE, 0) - eq(0, buffer.buf_valid(buf)) + eq(false, buffer.buf_valid(buf)) end) end) |