aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-06-12 13:05:43 -0400
committerGitHub <noreply@github.com>2021-06-12 13:05:43 -0400
commitd3bdde0bad12458128fae817aa348ac1d07b6f35 (patch)
tree24a75ed3a38cad6f410d00fa4933802dee183039
parentdb83be2daba27b36e69fe4dbcb8e565b18da7f2e (diff)
downloadrneovim-d3bdde0bad12458128fae817aa348ac1d07b6f35.tar.gz
rneovim-d3bdde0bad12458128fae817aa348ac1d07b6f35.tar.bz2
rneovim-d3bdde0bad12458128fae817aa348ac1d07b6f35.zip
test: clear $GZIP, use nvim's system() (#14791)
-rw-r--r--test/functional/legacy/011_autocommands_spec.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/functional/legacy/011_autocommands_spec.lua b/test/functional/legacy/011_autocommands_spec.lua
index 7cc31dc787..7b6f2f63e9 100644
--- a/test/functional/legacy/011_autocommands_spec.lua
+++ b/test/functional/legacy/011_autocommands_spec.lua
@@ -17,6 +17,7 @@ local lfs = require('lfs')
local clear, feed_command, expect, eq, neq, dedent, write_file, feed =
helpers.clear, helpers.feed_command, helpers.expect, helpers.eq, helpers.neq,
helpers.dedent, helpers.write_file, helpers.feed
+local command = helpers.command
local iswin = helpers.iswin
local read_file = helpers.read_file
@@ -28,7 +29,7 @@ end
local function prepare_gz_file(name, text)
write_file(name, text..'\n')
-- Compress the file with gzip.
- os.execute('gzip --force '..name)
+ command([[call system(['gzip', '--force', ']]..name..[['])]])
-- This should create the .gz file and delete the original.
neq(nil, lfs.attributes(name..'.gz'))
eq(nil, lfs.attributes(name))
@@ -54,7 +55,9 @@ describe('file reading, writing and bufnew and filter autocommands', function()
*/
]])
end)
- before_each(clear)
+ before_each(function ()
+ clear({env={GZIP=nil}})
+ end)
teardown(function()
os.remove('Xtestfile.gz')
os.remove('Xtest.c')
@@ -67,7 +70,6 @@ describe('file reading, writing and bufnew and filter autocommands', function()
it('FileReadPost (using gzip)', function()
prepare_gz_file('Xtestfile', text1)
- feed_command('let $GZIP = ""')
--execute('au FileChangedShell * echo "caught FileChangedShell"')
feed_command('set bin')
feed_command("au FileReadPost *.gz '[,']!gzip -d")
@@ -79,7 +81,6 @@ describe('file reading, writing and bufnew and filter autocommands', function()
it('BufReadPre, BufReadPost (using gzip)', function()
prepare_gz_file('Xtestfile', text1)
local gzip_data = read_file('Xtestfile.gz')
- feed_command('let $GZIP = ""')
-- Setup autocommands to decompress before reading and re-compress afterwards.
feed_command("au BufReadPre *.gz exe '!gzip -d ' . shellescape(expand('<afile>'))")
feed_command("au BufReadPre *.gz call rename(expand('<afile>:r'), expand('<afile>'))")