diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/legacy/arglist_spec.lua | 4 | ||||
-rw-r--r-- | test/unit/preprocess.lua | 25 |
2 files changed, 28 insertions, 1 deletions
diff --git a/test/functional/legacy/arglist_spec.lua b/test/functional/legacy/arglist_spec.lua index b86d3f0aea..f5e3522972 100644 --- a/test/functional/legacy/arglist_spec.lua +++ b/test/functional/legacy/arglist_spec.lua @@ -222,7 +222,6 @@ describe('argument list commands', function() execute('argedit a') eq({'a', 'b'}, eval('argv()')) eq('a', eval('expand("%:t")')) - assert_fails('argedit a b', 'E172:') execute('argedit c') eq({'a', 'c', 'b'}, eval('argv()')) execute('0argedit x') @@ -232,6 +231,9 @@ describe('argument list commands', function() execute('argedit! y') eq({'x', 'y', 'a', 'c', 'b'}, eval('argv()')) execute('%argd') + -- Nvim allows unescaped spaces in filename on all platforms. #6010 + execute('argedit a b') + eq({'a b'}, eval('argv()')) end) it('test for :argdelete command', function() diff --git a/test/unit/preprocess.lua b/test/unit/preprocess.lua index 1c9b290462..4d819e5f23 100644 --- a/test/unit/preprocess.lua +++ b/test/unit/preprocess.lua @@ -185,6 +185,30 @@ local function repeated_call(...) return nil end +function Gcc:filter_standard_defines(defines) + if not self.standard_defines then + local pseudoheader_fname = 'tmp_empty_pseudoheader.h' + local pseudoheader_file = io.open(pseudoheader_fname, 'w') + pseudoheader_file:close() + local standard_defines = repeated_call(self.path, + self.preprocessor_extra_flags, + self.get_defines_extra_flags, + {pseudoheader_fname}) + os.remove(pseudoheader_fname) + self.standard_defines = {} + for line in standard_defines:gmatch('[^\n]+') do + self.standard_defines[line] = true + end + end + local ret = {} + for line in defines:gmatch('[^\n]+') do + if not self.standard_defines[line] then + ret[#ret + 1] = line + end + end + return table.concat(ret, "\n") +end + -- returns a stream representing a preprocessed form of the passed-in headers. -- Don't forget to close the stream by calling the close() method on it. function Gcc:preprocess(previous_defines, ...) @@ -201,6 +225,7 @@ function Gcc:preprocess(previous_defines, ...) local defines = repeated_call(self.path, self.preprocessor_extra_flags, self.get_defines_extra_flags, {pseudoheader_fname}) + defines = self:filter_standard_defines(defines) -- lfs = require("lfs") -- print("CWD: #{lfs.currentdir!}") |