aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/let_spec.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2016-07-29 21:41:45 +0300
committerZyX <kp-pav@yandex.ru>2017-02-15 02:48:33 +0300
commitefa2682e3b513c4a33d987dc651db5913feff21a (patch)
tree46736cfd53da15a607a332afc79f8359f50bd455 /test/functional/eval/let_spec.lua
parent2a50ff7e2fa724fc748068ba19012239886b74dd (diff)
downloadrneovim-efa2682e3b513c4a33d987dc651db5913feff21a.tar.gz
rneovim-efa2682e3b513c4a33d987dc651db5913feff21a.tar.bz2
rneovim-efa2682e3b513c4a33d987dc651db5913feff21a.zip
*: 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`.
Diffstat (limited to 'test/functional/eval/let_spec.lua')
-rw-r--r--test/functional/eval/let_spec.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/functional/eval/let_spec.lua b/test/functional/eval/let_spec.lua
new file mode 100644
index 0000000000..c3ab3cc367
--- /dev/null
+++ b/test/functional/eval/let_spec.lua
@@ -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)