From fb9269a0cc9ffc557aed6fcb5d5d79413d2361bc Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Thu, 21 Feb 2013 01:31:33 +0000 Subject: [PATCH] Fix bugs in previous two commits. --- ansicolors.lua | 2 +- specs/ansicolors_spec.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ansicolors.lua b/ansicolors.lua index 2b8131d..7f7ae16 100644 --- a/ansicolors.lua +++ b/ansicolors.lua @@ -97,4 +97,4 @@ local function ansicolors( str ) end -return setmetatable({noReset = replaceCodes}, {__call = ansicolors}) +return setmetatable({noReset = replaceCodes}, {__call = function (_, str) return ansicolors (str) end}) diff --git a/specs/ansicolors_spec.lua b/specs/ansicolors_spec.lua index 0528f1d..cbca13b 100644 --- a/specs/ansicolors_spec.lua +++ b/specs/ansicolors_spec.lua @@ -38,11 +38,11 @@ describe('ansicolors', function() end) it('should add red underlined text', function() - assert_equal(ansicolors('%{red underline}foo'), c27 .. '[31m' .. c27 .. '[4mfoo') + assert_equal(ansicolors.noReset('%{red underline}foo'), c27 .. '[31m' .. c27 .. '[4mfoo') end) it('should with heterogeneous attributes', function() - assert_equal(ansicolors('%{bright white}*%{bright red}BEEP%{bright white}*'), c27 .. '[1m' .. c27 .. '[37m*' .. c27 .. '[1m' .. c27 .. '[31mBEEP' .. c27 .. '[1m' .. c27 .. '[37m*') + assert_equal(ansicolors.noReset('%{bright white}*%{bright red}BEEP%{bright white}*'), c27 .. '[1m' .. c27 .. '[37m*' .. c27 .. '[1m' .. c27 .. '[31mBEEP' .. c27 .. '[1m' .. c27 .. '[37m*') end) end)