aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLucas Hoffmann <l-m-h@web.de>2015-05-05 10:45:49 +0200
committerJustin M. Keyes <justinkz@gmail.com>2015-06-12 00:10:58 -0400
commitd080375813f91ca92a156726329d5411f7bf78df (patch)
tree51fd92beffec89ce667b46eeedc42dbf94d4296d /test
parente53dda90bdb66c78978f75a1eb209f7b601a74f0 (diff)
downloadrneovim-d080375813f91ca92a156726329d5411f7bf78df.tar.gz
rneovim-d080375813f91ca92a156726329d5411f7bf78df.tar.bz2
rneovim-d080375813f91ca92a156726329d5411f7bf78df.zip
tests: Migrate legacy test 74.
Helped-By: David Bürgin <676c7473@gmail.com> Helped-By: Justin M. Keyes <justinkz@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/functional/legacy/074_global_var_in_viminfo_spec.lua59
1 files changed, 59 insertions, 0 deletions
diff --git a/test/functional/legacy/074_global_var_in_viminfo_spec.lua b/test/functional/legacy/074_global_var_in_viminfo_spec.lua
new file mode 100644
index 0000000000..4f05db6a69
--- /dev/null
+++ b/test/functional/legacy/074_global_var_in_viminfo_spec.lua
@@ -0,0 +1,59 @@
+-- Tests for storing global variables in the .viminfo file
+
+local helpers, lfs = require('test.functional.helpers'), require('lfs')
+local clear, execute, eq, neq, eval, wait, spawn =
+ helpers.clear, helpers.execute, helpers.eq, helpers.neq, helpers.eval,
+ helpers.wait, helpers.spawn
+
+describe('storing global variables in viminfo files', function()
+ setup(function()
+ clear()
+ os.remove("Xviminfo")
+ end)
+
+ it('is working', function()
+ local nvim2 = helpers.spawn({helpers.nvim_prog, '-u', 'NONE', '--embed'})
+ helpers.set_session(nvim2)
+
+ local test_dict = {foo = 1, bar = 0, longvarible = 1000}
+ local test_list = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
+ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
+ 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100}
+
+ execute(
+ -- This will cause a few errors, do it silently.
+ 'set visualbell',
+ 'set viminfo+=!',
+ "let MY_GLOBAL_DICT={'foo': 1, 'bar': 0, 'longvarible': 1000}",
+ -- Store a really long list, so line wrapping will occur in viminfo
+ -- file.
+ 'let MY_GLOBAL_LIST=range(1,100)'
+ )
+ eq(test_dict, eval('MY_GLOBAL_DICT'))
+ eq(test_list, eval('MY_GLOBAL_LIST'))
+ -- Assert that the viminfo file does not exists.
+ eq(nil, lfs.attributes('Xviminfo'))
+ execute('wv! Xviminfo')
+ wait()
+ -- Assert that the viminfo file exists.
+ neq(nil, lfs.attributes('Xviminfo'))
+ execute('unlet MY_GLOBAL_DICT',
+ 'unlet MY_GLOBAL_LIST')
+ -- Assert that the variables where deleted.
+ eq(0, eval('exists("MY_GLOBAL_DICT")'))
+ eq(0, eval('exists("MY_GLOBAL_LIST")'))
+ execute('rv! Xviminfo')
+ -- Assert that the variables where restored.
+ eq(1, eval('exists("MY_GLOBAL_DICT")'))
+ eq(1, eval('exists("MY_GLOBAL_LIST")'))
+ eq(test_list, eval('MY_GLOBAL_LIST'))
+ eq(test_dict, eval('MY_GLOBAL_DICT'))
+ end)
+
+ teardown(function()
+ os.remove('Xviminfo')
+ end)
+end)