diff options
author | ZyX <kp-pav@yandex.ru> | 2018-02-02 00:55:22 +0300 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2018-02-02 07:28:56 -0500 |
commit | a2dfeb8a16117b51744ef3c37392a61396aa3ae5 (patch) | |
tree | ed2d16238003d934c6d6da0993ac7cae9aee8bd6 /test/functional/api/vim_spec.lua | |
parent | e243dbdc328b53926009153bd7fca32ebfc1abb2 (diff) | |
download | rneovim-a2dfeb8a16117b51744ef3c37392a61396aa3ae5.tar.gz rneovim-a2dfeb8a16117b51744ef3c37392a61396aa3ae5.tar.bz2 rneovim-a2dfeb8a16117b51744ef3c37392a61396aa3ae5.zip |
functests: Improve error reporting in _check_parsing function
May be needed for unit tests as well though.
Diffstat (limited to 'test/functional/api/vim_spec.lua')
-rw-r--r-- | test/functional/api/vim_spec.lua | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/test/functional/api/vim_spec.lua b/test/functional/api/vim_spec.lua index 39db831fe3..a92acd36b1 100644 --- a/test/functional/api/vim_spec.lua +++ b/test/functional/api/vim_spec.lua @@ -951,9 +951,20 @@ describe('api', function() end end) if not err then - msg = format_string('Error while processing test (%r, %s):\n%s', - str, FLAGS_TO_STR[flags], msg) - error(msg) + if type(msg) == 'table' then + local merr, new_msg = pcall( + format_string, 'table error:\n%s\n\n(%r)', msg.message, msg) + if merr then + msg = new_msg + else + msg = format_string('table error without .message:\n(%r)', + msg) + end + elseif type(msg) ~= 'string' then + msg = format_string('non-string non-table error:\n%r', msg) + end + error(format_string('Error while processing test (%r, %s):\n%s', + str, FLAGS_TO_STR[flags], msg)) end end end |