diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-10-02 09:49:11 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-10-02 09:49:11 -0400 |
commit | 60e5d8d1ccd5a07038138f18752620edebeb8a3d (patch) | |
tree | 1633766a082252e2b1074968377d1fd98481e496 /test/functional/helpers.lua | |
parent | 1f622d63bcd3018e5e714c02e6d0b58431c658e4 (diff) | |
parent | 45525853d3521e73512f68bb390aae0e385ef66c (diff) | |
download | rneovim-60e5d8d1ccd5a07038138f18752620edebeb8a3d.tar.gz rneovim-60e5d8d1ccd5a07038138f18752620edebeb8a3d.tar.bz2 rneovim-60e5d8d1ccd5a07038138f18752620edebeb8a3d.zip |
Merge pull request #1260 from tarruda/system-specs
Fix coverity defect(Resource leak) and add some specs which expose the bug to valgrind
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r-- | test/functional/helpers.lua | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 2b9ddfbe3c..671e34e592 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -31,9 +31,24 @@ local function execute(...) end end +local function eval(expr) + local status, result = pcall(function() return nvim_eval(expr) end) + if not status then + error('Failed to evaluate expression "' .. expr .. '"') + end + return result +end + +local function eq(expected, actual) + return assert.are.same(expected, actual) +end + +local function neq(expected, actual) + return assert.are_not.same(expected, actual) +end + local function expect(contents, first, last, buffer_index) - return assert.are.same(dedent(contents), - buffer_slice(first, last, buffer_idx)) + return eq(dedent(contents), buffer_slice(first, last, buffer_idx)) end rawfeed([[:function BeforeEachTest() @@ -80,5 +95,8 @@ return { insert = insert, feed = feed, execute = execute, + eval = eval, + eq = eq, + neq = neq, expect = expect } |