[ruby/reline] Use single quotes for non-expanded string literals

https://github.com/ruby/reline/commit/3bf7c7d722
This commit is contained in:
aycabta 2020-07-12 23:21:36 +09:00
Родитель f0e6ecec65
Коммит 568615d395
2 изменённых файлов: 17 добавлений и 4 удалений

Просмотреть файл

@ -42,6 +42,8 @@ class Reline::KeyStroke
expand(expand(rhs_bytes) + expand(input.drop(lhs.size))) expand(expand(rhs_bytes) + expand(input.drop(lhs.size)))
when Symbol when Symbol
[rhs] + expand(input.drop(lhs.size)) [rhs] + expand(input.drop(lhs.size))
when Array
rhs
end end
end end

Просмотреть файл

@ -16,10 +16,10 @@ class Reline::KeyStroke::Test < Reline::TestCase
def test_match_status def test_match_status
config = Reline::Config.new config = Reline::Config.new
{ {
"a" => "xx", 'a' => 'xx',
"ab" => "y", 'ab' => 'y',
"abc" => "z", 'abc' => 'z',
"x" => "rr" 'x' => 'rr'
}.each_pair do |key, func| }.each_pair do |key, func|
config.add_default_key_binding(key.bytes, func.bytes) config.add_default_key_binding(key.bytes, func.bytes)
end end
@ -35,4 +35,15 @@ class Reline::KeyStroke::Test < Reline::TestCase
assert_equal(:unmatched, stroke.match_status("m".bytes)) assert_equal(:unmatched, stroke.match_status("m".bytes))
assert_equal(:matched, stroke.match_status("abzwabk".bytes)) assert_equal(:matched, stroke.match_status("abzwabk".bytes))
end end
def test_aaa
config = Reline::Config.new
{
'abc' => '123',
}.each_pair do |key, func|
config.add_default_key_binding(key.bytes, func.bytes)
end
stroke = Reline::KeyStroke.new(config)
assert_equal('123'.bytes, stroke.expand('abc'.bytes))
end
end end