*: Partial string handling refactoring

Main points:

- Replace `char_u` with `char` in some cases.
- Remove `str[len] = NUL` hack in some cases when `str` may be considered
  `const`.
This commit is contained in:
ZyX
2016-07-29 21:41:45 +03:00
parent 2a50ff7e2f
commit efa2682e3b
32 changed files with 1289 additions and 1037 deletions

View File

@@ -0,0 +1,22 @@
local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq
local clear = helpers.clear
local meths = helpers.meths
local redir_exec = helpers.redir_exec
before_each(clear)
describe(':let command', function()
it('correctly lists variables with curly-braces', function()
meths.set_var('v', {0})
eq('\nv [0]', redir_exec('let {"v"}'))
end)
it('correctly lists variables with subscript', function()
meths.set_var('v', {0})
eq('\nv[0] #0', redir_exec('let v[0]'))
eq('\ng:["v"][0] #0', redir_exec('let g:["v"][0]'))
eq('\n{"g:"}["v"][0] #0', redir_exec('let {"g:"}["v"][0]'))
end)
end)