diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2015-01-23 23:52:48 +0100 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2015-02-02 14:56:58 -0300 |
commit | 97ac9f5c1de096e3ee0f273c1900aaaa176934a9 (patch) | |
tree | feadeb4841db10baac29fc7057065a92b803c420 | |
parent | 2eda611cbc9fc79b97d906f3810a2b5c0d928be6 (diff) | |
download | rneovim-97ac9f5c1de096e3ee0f273c1900aaaa176934a9.tar.gz rneovim-97ac9f5c1de096e3ee0f273c1900aaaa176934a9.tar.bz2 rneovim-97ac9f5c1de096e3ee0f273c1900aaaa176934a9.zip |
test/ui: more informative "unexpected highlight" errors
-rw-r--r-- | test/functional/ui/screen.lua | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index ef99c2a536..4a51ef278e 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -438,11 +438,7 @@ function Screen:snapshot_util(attrs, ignore) if self._default_attr_ids == nil or self._default_attr_ids[i] ~= a then alldefault = false end - local items = {} - for f, v in pairs(a) do - table.insert(items, f.." = "..tostring(v)) - end - local dict = "{"..table.concat(items, ", ").."}" + local dict = "{"..pprint_attrs(a).."}" table.insert(attrstrs, "["..tostring(i).."] = "..dict) end local attrstr = "{"..table.concat(attrstrs, ", ").."}" @@ -455,6 +451,13 @@ function Screen:snapshot_util(attrs, ignore) end end +function pprint_attrs(attrs) + local items = {} + for f, v in pairs(attrs) do + table.insert(items, f.." = "..tostring(v)) + end + return table.concat(items, ", ") +end function backward_find_meaningful(tbl, from) for i = from or #tbl, 1, -1 do @@ -478,7 +481,7 @@ function get_attr_id(attr_ids, attr_ignore, attrs) -- ignore this attrs return nil end - return "UNEXPECTED" + return "UNEXPECTED "..pprint_attrs(attrs) end function equal_attrs(a, b) |