diff options
Diffstat (limited to 'test/functional')
| -rw-r--r-- | test/functional/legacy/assert_spec.lua | 18 | 
1 files changed, 18 insertions, 0 deletions
| diff --git a/test/functional/legacy/assert_spec.lua b/test/functional/legacy/assert_spec.lua index 1ce665360d..63699387c1 100644 --- a/test/functional/legacy/assert_spec.lua +++ b/test/functional/legacy/assert_spec.lua @@ -142,4 +142,22 @@ describe('assert function:', function()        })      end)    end) + +  -- assert_fails({cmd}, [, {error}]) +  describe('assert_fails', function() +    it('should change v:errors when error does not match v:errmsg', function() +      execute([[call assert_fails('xxx', {})]]) +      expected_errors({"Expected {} but got 'E731: using Dictionary as a String'"}) +    end) + +    it('should not change v:errors when cmd errors', function() +      call('assert_fails', 'NonexistentCmd') +      expected_empty() +    end) + +    it('should change v:errors when cmd succeeds', function() +      call('assert_fails', 'call empty("")') +      expected_errors({'command did not fail: call empty("")'}) +    end) +  end)  end) | 
