[ruby/irb] Show code page by irb_info on Windows
https://github.com/ruby/irb/commit/6160d74199
This commit is contained in:
parent
456d0019dd
commit
f1035248af
@ -16,6 +16,10 @@ module IRB
|
|||||||
str += "RUBY_PLATFORM: #{RUBY_PLATFORM}\n"
|
str += "RUBY_PLATFORM: #{RUBY_PLATFORM}\n"
|
||||||
str += "LANG env: #{ENV["LANG"]}\n" if ENV["LANG"] && !ENV["LANG"].empty?
|
str += "LANG env: #{ENV["LANG"]}\n" if ENV["LANG"] && !ENV["LANG"].empty?
|
||||||
str += "LC_ALL env: #{ENV["LC_ALL"]}\n" if ENV["LC_ALL"] && !ENV["LC_ALL"].empty?
|
str += "LC_ALL env: #{ENV["LC_ALL"]}\n" if ENV["LC_ALL"] && !ENV["LC_ALL"].empty?
|
||||||
|
if RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
||||||
|
codepage = `chcp`.sub(/Active code page: (\d+)\n/, '\1')
|
||||||
|
str += "Code page: #{codepage}\n"
|
||||||
|
end
|
||||||
str
|
str
|
||||||
end
|
end
|
||||||
alias_method :to_s, :inspect
|
alias_method :to_s, :inspect
|
||||||
|
@ -47,6 +47,7 @@ module TestIRB
|
|||||||
@default_encoding = [Encoding.default_external, Encoding.default_internal]
|
@default_encoding = [Encoding.default_external, Encoding.default_internal]
|
||||||
@stdio_encodings = [STDIN, STDOUT, STDERR].map {|io| [io.external_encoding, io.internal_encoding] }
|
@stdio_encodings = [STDIN, STDOUT, STDERR].map {|io| [io.external_encoding, io.internal_encoding] }
|
||||||
IRB.instance_variable_get(:@CONF).clear
|
IRB.instance_variable_get(:@CONF).clear
|
||||||
|
@is_win = (RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/)
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
@ -80,6 +81,7 @@ module TestIRB
|
|||||||
InputMethod:\sAbstract\sInputMethod\n
|
InputMethod:\sAbstract\sInputMethod\n
|
||||||
\.irbrc\spath:\s.+\n
|
\.irbrc\spath:\s.+\n
|
||||||
RUBY_PLATFORM:\s.+\n
|
RUBY_PLATFORM:\s.+\n
|
||||||
|
#{@is_win ? 'Code\spage:\s\d+\n' : ''}
|
||||||
}x
|
}x
|
||||||
assert_match expected, irb.context.main.irb_info.to_s
|
assert_match expected, irb.context.main.irb_info.to_s
|
||||||
ensure
|
ensure
|
||||||
@ -105,6 +107,7 @@ module TestIRB
|
|||||||
InputMethod:\sAbstract\sInputMethod\n
|
InputMethod:\sAbstract\sInputMethod\n
|
||||||
\.irbrc\spath:\s.+\n
|
\.irbrc\spath:\s.+\n
|
||||||
RUBY_PLATFORM:\s.+\n
|
RUBY_PLATFORM:\s.+\n
|
||||||
|
#{@is_win ? 'Code\spage:\s\d+\n' : ''}
|
||||||
}x
|
}x
|
||||||
assert_match expected, irb.context.main.irb_info.to_s
|
assert_match expected, irb.context.main.irb_info.to_s
|
||||||
ensure
|
ensure
|
||||||
@ -132,6 +135,7 @@ module TestIRB
|
|||||||
IRB\sversion:\sirb\s.+\n
|
IRB\sversion:\sirb\s.+\n
|
||||||
InputMethod:\sAbstract\sInputMethod\n
|
InputMethod:\sAbstract\sInputMethod\n
|
||||||
RUBY_PLATFORM:\s.+\n
|
RUBY_PLATFORM:\s.+\n
|
||||||
|
#{@is_win ? 'Code\spage:\s\d+\n' : ''}
|
||||||
\z
|
\z
|
||||||
}x
|
}x
|
||||||
assert_match expected, irb.context.main.irb_info.to_s
|
assert_match expected, irb.context.main.irb_info.to_s
|
||||||
@ -163,6 +167,7 @@ module TestIRB
|
|||||||
IRB\sversion:\sirb\s.+\n
|
IRB\sversion:\sirb\s.+\n
|
||||||
InputMethod:\sAbstract\sInputMethod\n
|
InputMethod:\sAbstract\sInputMethod\n
|
||||||
RUBY_PLATFORM:\s.+\n
|
RUBY_PLATFORM:\s.+\n
|
||||||
|
#{@is_win ? 'Code\spage:\s\d+\n' : ''}
|
||||||
\z
|
\z
|
||||||
}x
|
}x
|
||||||
assert_match expected, irb.context.main.irb_info.to_s
|
assert_match expected, irb.context.main.irb_info.to_s
|
||||||
|
Loading…
x
Reference in New Issue
Block a user