1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
require 'test_helper'
require 'ansi/code'
testcase ANSI::Code do
unit :red do
str = ANSI::Code.red
out = "\e[31m"
out.assert == str
end
omit :red => "with block notation" do
str = ANSI::Code.red { "Hello" }
out = "\e[31mHello\e[0m"
out.assert == str
end
unit :blue do
str = ANSI::Code.blue
out = "\e[34m"
out.assert == str
end
omit :blue => "with block notation" do
str = ANSI::Code.blue { "World" }
out = "\e[34mWorld\e[0m"
out.assert == str
end
end
|