From a6d1ac54e6c18dbcf8aff7c2be9c6e6980c0104e Mon Sep 17 00:00:00 2001 From: tomoya ishida Date: Thu, 28 Nov 2024 03:36:53 +0900 Subject: [PATCH] fix/omit test that fail in encoding=US_ASCII (#784) --- test/reline/test_key_stroke.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/reline/test_key_stroke.rb b/test/reline/test_key_stroke.rb index 98080845dc..8f5c767ca4 100644 --- a/test/reline/test_key_stroke.rb +++ b/test/reline/test_key_stroke.rb @@ -103,14 +103,18 @@ def test_with_reline_key stroke = Reline::KeyStroke.new(config, encoding) assert_equal(Reline::KeyStroke::UNMATCHED, stroke.match_status('da'.bytes)) assert_equal(Reline::KeyStroke::MATCHED, stroke.match_status("\eda".bytes)) - assert_equal(Reline::KeyStroke::UNMATCHED, stroke.match_status([32, 195, 164])) + assert_equal(Reline::KeyStroke::UNMATCHED, stroke.match_status(" \eda".bytes)) assert_equal(Reline::KeyStroke::MATCHED, stroke.match_status([195, 164])) end def test_multibyte_matching + begin + char = 'あ'.encode(encoding) + rescue Encoding::UndefinedConversionError + omit + end config = Reline::Config.new stroke = Reline::KeyStroke.new(config, encoding) - char = 'あ'.encode(encoding) key = Reline::Key.new(char.ord, char.ord, false) bytes = char.bytes assert_equal(Reline::KeyStroke::MATCHED, stroke.match_status(bytes))