From 9d5d72c388b404c7e9e7aedd521bb5abe46c9436 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 16 Sep 2021 11:42:00 -0700 Subject: [PATCH] fix(test runner): handle nil in no-colors output handler #15679 Problem: 13748512f6d6 #15610 The no-colors codepath of the nvim.lua test output handler does not handle nil, leading to weird symptoms if e.g. a test has a syntax error: test/busted/outputHandlers/nvim.lua:105: attempt to concatenate a nil value Solution: Coerce to string in no-colors handler. --- test/busted/outputHandlers/nvim.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/busted/outputHandlers/nvim.lua b/test/busted/outputHandlers/nvim.lua index 31d3415e35..0e9801b94b 100644 --- a/test/busted/outputHandlers/nvim.lua +++ b/test/busted/outputHandlers/nvim.lua @@ -2,7 +2,7 @@ local pretty = require 'pl.pretty' local global_helpers = require('test.helpers') -- Colors are disabled by default. #15610 -local colors = setmetatable({}, {__index = function() return function(s) return s end end}) +local colors = setmetatable({}, {__index = function() return function(s) return s == nil and '' or tostring(s) end end}) if os.getenv "TEST_COLORS" then colors = require 'term.colors' end