diff options
author | ZyX <kp-pav@yandex.ru> | 2016-01-31 00:06:46 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2016-04-18 02:44:03 +0300 |
commit | 18903bd9b88ec960cb36b1ddd2b5062aad4bac2e (patch) | |
tree | 9ebe49b05cf661bb38a39e86c6f085dded032d75 /test/functional/eval/special_vars_spec.lua | |
parent | 256a5d25226505c56c067d35d715f1a184cd05ee (diff) | |
download | rneovim-18903bd9b88ec960cb36b1ddd2b5062aad4bac2e.tar.gz rneovim-18903bd9b88ec960cb36b1ddd2b5062aad4bac2e.tar.bz2 rneovim-18903bd9b88ec960cb36b1ddd2b5062aad4bac2e.zip |
eval: Add special variable type
Diffstat (limited to 'test/functional/eval/special_vars_spec.lua')
-rw-r--r-- | test/functional/eval/special_vars_spec.lua | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/functional/eval/special_vars_spec.lua b/test/functional/eval/special_vars_spec.lua new file mode 100644 index 0000000000..7adc529c88 --- /dev/null +++ b/test/functional/eval/special_vars_spec.lua @@ -0,0 +1,36 @@ +local helpers = require('test.functional.helpers') +local execute = helpers.execute +local funcs = helpers.funcs +local clear = helpers.clear +local eval = helpers.eval + +describe('Special values', function() + before_each(clear) + + it('do not cause error when freed', function() + execute([[ + function Test() + try + return v:true + finally + return 'something else' + endtry + endfunction + ]]) + eq(true, funcs.Test()) + end) + + it('work with empty()', function() + eq(0, funcs.empty(true)) + eq(1, funcs.empty(false)) + eq(1, funcs.empty(nil)) + eq(1, eval('empty(v:none)')) + end) + + it('can be stringified and eval’ed back', function() + eq(true, funcs.eval(funcs.string(true))) + eq(false, funcs.eval(funcs.string(false))) + eq(nil, funcs.eval(funcs.string(nil))) + eq(1, eval('eval(string(v:none)) is# v:none')) + end) +end) |