aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/assert_spec.lua
diff options
context:
space:
mode:
authorPatrick <patrick@bitscope.com>2016-06-30 15:13:20 +1000
committerprollings <patrick@patrick.com>2016-06-30 22:35:06 +1000
commit8e804c911edbeb171d66f0b3f1dc1ffecd8e4d39 (patch)
tree7d259e57eca6a62d612d5ad53d814252a5a79481 /test/functional/legacy/assert_spec.lua
parent204f557a11e27b20a0343788500b4bdda36d4c3f (diff)
downloadrneovim-8e804c911edbeb171d66f0b3f1dc1ffecd8e4d39.tar.gz
rneovim-8e804c911edbeb171d66f0b3f1dc1ffecd8e4d39.tar.bz2
rneovim-8e804c911edbeb171d66f0b3f1dc1ffecd8e4d39.zip
vim-patch:7.4.1136
Problem: Wrong argument to assert_exception() causes a crash. (reported by Coverity) Solution: Check for NULL pointer. Add a test. https://github.com/vim/vim/commit/da5dcd936656f524dd0ae7cb2685245f07f5720f
Diffstat (limited to 'test/functional/legacy/assert_spec.lua')
-rw-r--r--test/functional/legacy/assert_spec.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/functional/legacy/assert_spec.lua b/test/functional/legacy/assert_spec.lua
index cfa368c361..8da6ee45d7 100644
--- a/test/functional/legacy/assert_spec.lua
+++ b/test/functional/legacy/assert_spec.lua
@@ -172,4 +172,34 @@ describe('assert function:', function()
expected_errors({'command did not fail: call empty("")'})
end)
end)
+
+ -- assert_exception({cmd}, [, {error}])
+ describe('assert_exception()', function()
+ it('should assert thrown exceptions properly', function()
+ source([[
+ try
+ nocommand
+ catch
+ call assert_exception('E492')
+ endtry
+ ]])
+ expected_empty()
+ end)
+
+ it('should work properly when nested', function()
+ source([[
+ try
+ nocommand
+ catch
+ try
+ " illegal argument, get NULL for error
+ call assert_exception([])
+ catch
+ call assert_exception('E730')
+ endtry
+ endtry
+ ]])
+ expected_empty()
+ end)
+ end)
end)