Skip to content

Commit

Permalink
fix/omit test that fail in encoding=US_ASCII (#784)
Browse files Browse the repository at this point in the history
  • Loading branch information
tompng authored Nov 27, 2024
1 parent 5a8da85 commit a6d1ac5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/reline/test_key_stroke.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit a6d1ac5

Please sign in to comment.