diff options
author | aycabta <aycabta@gmail.com> | 2021-04-20 12:00:08 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2021-06-21 17:58:48 +0900 |
commit | b0cc46b484028b65b3306e9d19803e49c7b7cd58 (patch) | |
tree | 1cdf469221dbcf57c12f8ce7690018a691f7e257 /test/reline/test_config.rb | |
parent | c59bbd86a6bd0f1ce8a7babf56feabeb41a7e675 (diff) | |
download | ruby-b0cc46b484028b65b3306e9d19803e49c7b7cd58.tar.gz |
[ruby/reline] The config file must accept any character encoding
In Japan, so many programmers used EUC-JP to write text files that contain
Japanese. Many .inputrc files which contain EUC-JP are still being copied and
used. This commit supports the whole encoding of what user set including UTF-8.
ref. https://github.com/ruby/reline/pull/280
https://github.com/ruby/reline/commit/0b45022e16
Diffstat (limited to 'test/reline/test_config.rb')
-rw-r--r-- | test/reline/test_config.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/test/reline/test_config.rb b/test/reline/test_config.rb index 2ada00c154..56fc787b65 100644 --- a/test/reline/test_config.rb +++ b/test/reline/test_config.rb @@ -286,14 +286,25 @@ class Reline::Config::Test < Reline::TestCase ENV['INPUTRC'] = inputrc_backup end - def test_inputrc_with_utf + def test_inputrc_with_utf8 + # This file is encoded by UTF-8 so this heredoc string is also UTF-8. @config.read_lines(<<~'LINES'.lines) set editing-mode vi set vi-cmd-mode-string 🍸 set vi-ins-mode-string 🍶 LINES - assert_equal @config.vi_cmd_mode_string, "🍸" - assert_equal @config.vi_ins_mode_string, "🍶" + assert_equal '🍸', @config.vi_cmd_mode_string + assert_equal '🍶', @config.vi_ins_mode_string + end + + def test_inputrc_with_eucjp + @config.read_lines(<<~"LINES".encode(Encoding::EUC_JP).lines) + set editing-mode vi + set vi-cmd-mode-string ォャッ + set vi-ins-mode-string 能 + LINES + assert_equal 'ォャッ'.encode(Reline.encoding_system_needs), @config.vi_cmd_mode_string + assert_equal '能'.encode(Reline.encoding_system_needs), @config.vi_ins_mode_string end def test_xdg_config_home |