ruby-changes:62622
From: aycabta <ko1@a...>
Date: Tue, 18 Aug 2020 19:16:05 +0900 (JST)
Subject: [ruby-changes:62622] 568615d395 (master): [ruby/reline] Use single quotes for non-expanded string literals
https://git.ruby-lang.org/ruby.git/commit/?id=568615d395 From 568615d3952f332d971b00ba30eeedc3606a51c0 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Sun, 12 Jul 2020 23:21:36 +0900 Subject: [ruby/reline] Use single quotes for non-expanded string literals https://github.com/ruby/reline/commit/3bf7c7d722 diff --git a/lib/reline/key_stroke.rb b/lib/reline/key_stroke.rb index 83136ed..017e3db 100644 --- a/lib/reline/key_stroke.rb +++ b/lib/reline/key_stroke.rb @@ -42,6 +42,8 @@ class Reline::KeyStroke https://github.com/ruby/ruby/blob/trunk/lib/reline/key_stroke.rb#L42 expand(expand(rhs_bytes) + expand(input.drop(lhs.size))) when Symbol [rhs] + expand(input.drop(lhs.size)) + when Array + rhs end end diff --git a/test/reline/test_key_stroke.rb b/test/reline/test_key_stroke.rb index 224e93d..15675a9 100644 --- a/test/reline/test_key_stroke.rb +++ b/test/reline/test_key_stroke.rb @@ -16,10 +16,10 @@ class Reline::KeyStroke::Test < Reline::TestCase https://github.com/ruby/ruby/blob/trunk/test/reline/test_key_stroke.rb#L16 def test_match_status config = Reline::Config.new { - "a" => "xx", - "ab" => "y", - "abc" => "z", - "x" => "rr" + 'a' => 'xx', + 'ab' => 'y', + 'abc' => 'z', + 'x' => 'rr' }.each_pair do |key, func| config.add_default_key_binding(key.bytes, func.bytes) end @@ -35,4 +35,15 @@ class Reline::KeyStroke::Test < Reline::TestCase https://github.com/ruby/ruby/blob/trunk/test/reline/test_key_stroke.rb#L35 assert_equal(:unmatched, stroke.match_status("m".bytes)) assert_equal(:matched, stroke.match_status("abzwabk".bytes)) 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/