Skip to content

Commit

Permalink
Fix bugs in previous two commits.
Browse files Browse the repository at this point in the history
  • Loading branch information
rrthomas committed Feb 21, 2013
1 parent a8b791d commit fb9269a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ansicolors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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})
4 changes: 2 additions & 2 deletions specs/ansicolors_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fb9269a

Please sign in to comment.