Skip to content

Commit

Permalink
Fix colorize specs on dumb terminal (#8673)
Browse files Browse the repository at this point in the history
* Fix colorize specs on dumb terminal

The wrapper that unconditionally applies colorize was not correctly used in all places.

* Update colorize_spec.cr
  • Loading branch information
oprypin authored and RX14 committed Jan 11, 2020
1 parent 912c4d4 commit 0ae289d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions spec/std/colorize_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ end
private class ColorizeToS
def to_s(io)
io << "hello"
io << "world".colorize.blue
io << ::colorize("world").blue
io << "bye"
end
end
Expand Down Expand Up @@ -133,7 +133,7 @@ describe "colorize" do
io = IO::Memory.new
with_color_wrap.red.surround(io) do
io << "hello"
with_color.green.surround(io) do
with_color_wrap.green.surround(io) do
io << "world"
end
io << "bye"
Expand Down Expand Up @@ -178,7 +178,7 @@ describe "colorize" do
end

it "colorizes with to_s" do
ColorizeToS.new.colorize.red.to_s.should eq("\e[31mhello\e[0;34mworld\e[0;31mbye\e[0m")
colorize(ColorizeToS.new).red.to_s.should eq("\e[31mhello\e[0;34mworld\e[0;31mbye\e[0m")
end

it "toggles off" do
Expand Down

0 comments on commit 0ae289d

Please sign in to comment.