diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2015-02-16 20:13:55 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-02-16 20:13:55 -0500 |
commit | 3bb77befe502d3c526dd834f8df4f6c30e595bcf (patch) | |
tree | e4d4bb33444bbcf66a94b33bc2dbe939ce85b09f | |
parent | fd636fc6dcd8a547daab1544432877bf8efa0c1e (diff) | |
parent | f4f0f646c33151baff90ac632791568364a9a62c (diff) | |
download | rneovim-3bb77befe502d3c526dd834f8df4f6c30e595bcf.tar.gz rneovim-3bb77befe502d3c526dd834f8df4f6c30e595bcf.tar.bz2 rneovim-3bb77befe502d3c526dd834f8df4f6c30e595bcf.zip |
Merge #1981 'treat NULL initialized vimscript string as api type String'
-rw-r--r-- | src/nvim/api/private/helpers.c | 6 | ||||
-rw-r--r-- | test/functional/api/vim_spec.lua | 5 | ||||
-rw-r--r-- | test/functional/shell/viml_system_spec.lua | 2 |
3 files changed, 8 insertions, 5 deletions
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index 8083b819d8..39ca0756f3 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -644,10 +644,8 @@ static Object vim_to_object_rec(typval_T *obj, PMap(ptr_t) *lookup) switch (obj->v_type) { case VAR_STRING: - if (obj->vval.v_string != NULL) { - rv.type = kObjectTypeString; - rv.data.string = cstr_to_string((char *) obj->vval.v_string); - } + rv.type = kObjectTypeString; + rv.data.string = cstr_to_string((char *) obj->vval.v_string); break; case VAR_NUMBER: diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index bee9c18bd8..cbdb1980f0 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -27,6 +27,11 @@ describe('vim_* functions', function() nvim('command', 'let g:v2 = [1, 2, {"v3": 3}]') eq({v1 = 'a', v2 = {1, 2, {v3 = 3}}}, nvim('eval', 'g:')) end) + + it('handles NULL-initialized strings correctly', function() + eq(1, nvim('eval',"matcharg(1) == ['', '']")) + eq({'', ''}, nvim('eval','matcharg(1)')) + end) end) describe('strwidth', function() diff --git a/test/functional/shell/viml_system_spec.lua b/test/functional/shell/viml_system_spec.lua index d24646e712..b35f070159 100644 --- a/test/functional/shell/viml_system_spec.lua +++ b/test/functional/shell/viml_system_spec.lua @@ -191,7 +191,7 @@ describe('system()', function() if xclip then describe("with a program that doesn't close stdout", function() it('will exit properly after passing input', function() - eq(nil, eval([[system('xclip -i -selection clipboard', 'clip-data')]])) + eq('', eval([[system('xclip -i -selection clipboard', 'clip-data')]])) eq('clip-data', eval([[system('xclip -o -selection clipboard')]])) end) end) |