mirror of
https://github.com/ruby/ruby.git
synced 2025-09-22 20:14:02 +02:00
[ruby/irb] respect NO_COLOR environment variable
When `NO_COLOR` is set to any non-nil value, output is not colorized.
See https://no-color.org/
401d0916fe
This commit is contained in:
parent
e16a642900
commit
b8ffb1c46f
2 changed files with 18 additions and 2 deletions
|
@ -67,6 +67,22 @@ module TestIRB
|
|||
Process.kill("SIGKILL", status.pid) if !status.exited? && !status.stopped? && !status.signaled?
|
||||
end
|
||||
|
||||
def test_no_color_environment_variable
|
||||
orig = ENV['NO_COLOR']
|
||||
|
||||
assert IRB.conf[:USE_COLORIZE]
|
||||
|
||||
ENV['NO_COLOR'] = 'true'
|
||||
IRB.setup(eval("__FILE__"))
|
||||
refute IRB.conf[:USE_COLORIZE]
|
||||
|
||||
ENV['NO_COLOR'] = nil
|
||||
IRB.setup(eval("__FILE__"))
|
||||
assert IRB.conf[:USE_COLORIZE]
|
||||
ensure
|
||||
ENV['NO_COLOR'] = orig
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def with_argv(argv)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue