Remove test/reline temporary, I'll come back

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
aycabta 2019-04-21 03:51:26 +00:00
Родитель 2a5ea43507
Коммит 2dc51bf447
6 изменённых файлов: 0 добавлений и 2651 удалений

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

@ -1,113 +0,0 @@
require_relative 'helper'
class Reline::Config::Test < Reline::TestCase
def setup
@pwd = Dir.pwd
@tmpdir = File.join(Dir.tmpdir, "test_reline_config_#{$$}")
Dir.mkdir(@tmpdir)
Dir.chdir(@tmpdir)
@config = Reline::Config.new
end
def teardown
Dir.chdir(@pwd)
FileUtils.rm_rf(@tmpdir)
end
def test_read_lines
@config.read_lines(<<~LINES.split(/(?<=\n)/))
set bell-style on
LINES
assert_equal :audible, @config.instance_variable_get(:@bell_style)
end
def test_bind_key
key, func = @config.bind_key('"input"', '"abcde"')
assert_equal 'input', key
assert_equal 'abcde', func
end
def test_bind_key_with_macro
key, func = @config.bind_key('"input"', 'abcde')
assert_equal 'input', key
assert_equal :abcde, func
end
def test_bind_key_with_escaped_chars
assert_equal ['input', "\e \\ \" ' \a \b \d \f \n \r \t \v"], @config.bind_key('"input"', '"\\e \\\\ \\" \\\' \\a \\b \\d \\f \\n \\r \\t \\v"')
end
def test_bind_key_with_ctrl_chars
assert_equal ['input', "\C-h\C-h"], @config.bind_key('"input"', '"\C-h\C-H"')
end
def test_bind_key_with_meta_chars
assert_equal ['input', "\M-h\M-H".force_encoding('ASCII-8BIT')], @config.bind_key('"input"', '"\M-h\M-H"')
end
def test_bind_key_with_octal_number
assert_equal ['input', "\1"], @config.bind_key('"input"', '"\1"')
assert_equal ['input', "\12"], @config.bind_key('"input"', '"\12"')
assert_equal ['input', "\123"], @config.bind_key('"input"', '"\123"')
assert_equal ['input', ["\123", '4'].join], @config.bind_key('"input"', '"\1234"')
end
def test_bind_key_with_hexadecimal_number
assert_equal ['input', "\x4"], @config.bind_key('"input"', '"\x4"')
assert_equal ['input', "\x45"], @config.bind_key('"input"', '"\x45"')
assert_equal ['input', ["\x45", '6'].join], @config.bind_key('"input"', '"\x456"')
end
def test_include
File.open('included_partial', 'wt') do |f|
f.write(<<~PARTIAL_LINES)
set bell-style on
PARTIAL_LINES
end
@config.read_lines(<<~LINES.split(/(?<=\n)/))
$include included_partial
LINES
assert_equal :audible, @config.instance_variable_get(:@bell_style)
end
def test_if
@config.read_lines(<<~LINES.split(/(?<=\n)/))
$if Ruby
set bell-style audible
$else
set bell-style visible
$endif
LINES
assert_equal :audible, @config.instance_variable_get(:@bell_style)
end
def test_if_with_false
@config.read_lines(<<~LINES.split(/(?<=\n)/))
$if Python
set bell-style audible
$else
set bell-style visible
$endif
LINES
assert_equal :visible, @config.instance_variable_get(:@bell_style)
end
def test_if_with_indent
@config.read_lines(<<~LINES.split(/(?<=\n)/))
set bell-style none
$if Ruby
set bell-style audible
$else
set bell-style visible
$endif
LINES
assert_equal :audible, @config.instance_variable_get(:@bell_style)
end
end

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

@ -1,66 +0,0 @@
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'reline'
require 'test/unit'
RELINE_TEST_ENCODING = (Encoding.find(ENV['RELINE_TEST_ENCODING']) if ENV['RELINE_TEST_ENCODING'])
class Reline::TestCase < Test::Unit::TestCase
private def convert_str(input, options = {}, normalized = nil)
return nil if input.nil?
input.chars.map { |c|
if Reline::Unicode::EscapedChars.include?(c.ord)
c
else
c.encode(@line_editor.instance_variable_get(:@encoding), Encoding::UTF_8, options)
end
}.join
rescue Encoding::UndefinedConversionError, Encoding::InvalidByteSequenceError
input.unicode_normalize!(:nfc)
if normalized
options[:undef] = :replace
options[:replace] = '?'
end
normalized = true
retry
end
def input_keys(input, convert = true)
input = convert_str(input) if convert
input.chars.each do |c|
if c.bytesize == 1
eighth_bit = 0b10000000
byte = c.bytes.first
if byte.allbits?(eighth_bit)
@line_editor.input_key("\e".ord)
byte ^= eighth_bit
end
@line_editor.input_key(byte)
else
c.bytes.each do |b|
@line_editor.input_key(b)
end
end
end
end
def assert_line(expected)
expected = convert_str(expected)
assert_equal(expected, @line_editor.line)
end
def assert_byte_pointer_size(expected)
expected = convert_str(expected)
byte_pointer = @line_editor.instance_variable_get(:@byte_pointer)
assert_equal(
expected.bytesize, byte_pointer,
"<#{expected.inspect}> expected but was\n<#{@line_editor.line.byteslice(0, byte_pointer).inspect}>")
end
def assert_cursor(expected)
assert_equal(expected, @line_editor.instance_variable_get(:@cursor))
end
def assert_cursor_max(expected)
assert_equal(expected, @line_editor.instance_variable_get(:@cursor_max))
end
end

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,990 +0,0 @@
require_relative 'helper'
class Reline::KeyActor::ViInsert::Test < Reline::TestCase
def setup
@prompt = '> '
@config = Reline::Config.new
@config.read_lines(<<~LINES.split(/(?<=\n)/))
set editing-mode vi
LINES
@line_editor = Reline::LineEditor.new(
@config, @prompt,
(RELINE_TEST_ENCODING rescue Encoding.default_external))
@line_editor.retrieve_completion_block = Reline.method(:retrieve_completion_block)
end
def test_vi_command_mode
input_keys("\C-[")
assert_instance_of(Reline::KeyActor::ViCommand, @config.editing_mode)
end
def test_vi_command_mode_with_input
input_keys("abc\C-[")
assert_instance_of(Reline::KeyActor::ViCommand, @config.editing_mode)
assert_line('abc')
end
def test_ed_insert_one
input_keys('a')
assert_line('a')
assert_byte_pointer_size('a')
assert_cursor(1)
assert_cursor_max(1)
end
def test_ed_insert_two
input_keys('ab')
assert_line('ab')
assert_byte_pointer_size('ab')
assert_cursor(2)
assert_cursor_max(2)
end
def test_ed_insert_mbchar_one
input_keys('か')
assert_line('か')
assert_byte_pointer_size('か')
assert_cursor(2)
assert_cursor_max(2)
end
def test_ed_insert_mbchar_two
input_keys('かき')
assert_line('かき')
assert_byte_pointer_size('かき')
assert_cursor(4)
assert_cursor_max(4)
end
def test_ed_insert_for_mbchar_by_plural_code_points
input_keys("\u3099")
assert_line("\u3099")
assert_byte_pointer_size("\u3099")
assert_cursor(2)
assert_cursor_max(2)
end
def test_ed_insert_for_plural_mbchar_by_plural_code_points
input_keys("\u3099き\u3099")
assert_line("\u3099き\u3099")
assert_byte_pointer_size("\u3099き\u3099")
assert_cursor(4)
assert_cursor_max(4)
end
def test_ed_next_char
input_keys("abcdef\C-[0")
assert_line('abcdef')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(6)
input_keys('l')
assert_line('abcdef')
assert_byte_pointer_size('a')
assert_cursor(1)
assert_cursor_max(6)
input_keys('2l')
assert_line('abcdef')
assert_byte_pointer_size('abc')
assert_cursor(3)
assert_cursor_max(6)
end
def test_ed_prev_char
input_keys("abcdef\C-[")
assert_line('abcdef')
assert_byte_pointer_size('abcde')
assert_cursor(5)
assert_cursor_max(6)
input_keys('h')
assert_line('abcdef')
assert_byte_pointer_size('abcd')
assert_cursor(4)
assert_cursor_max(6)
input_keys('2h')
assert_line('abcdef')
assert_byte_pointer_size('ab')
assert_cursor(2)
assert_cursor_max(6)
end
def test_history
Reline::HISTORY.concat(%w{abc 123 AAA})
input_keys("\C-[")
assert_line('')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(0)
input_keys('k')
assert_line('AAA')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(3)
input_keys('2k')
assert_line('abc')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(3)
input_keys('j')
assert_line('123')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(3)
input_keys('2j')
assert_line('')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(0)
end
def test_vi_paste_prev
input_keys("abcde\C-[3h")
assert_line('abcde')
assert_byte_pointer_size('a')
assert_cursor(1)
assert_cursor_max(5)
input_keys('P')
assert_line('abcde')
assert_byte_pointer_size('a')
assert_cursor(1)
assert_cursor_max(5)
input_keys('d$')
assert_line('a')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(1)
input_keys('P')
assert_line('bcdea')
assert_byte_pointer_size('bcd')
assert_cursor(3)
assert_cursor_max(5)
input_keys('2P')
assert_line('bcdbcdbcdeeea')
assert_byte_pointer_size('bcdbcdbcd')
assert_cursor(9)
assert_cursor_max(13)
end
def test_vi_paste_next
input_keys("abcde\C-[3h")
assert_line('abcde')
assert_byte_pointer_size('a')
assert_cursor(1)
assert_cursor_max(5)
input_keys('p')
assert_line('abcde')
assert_byte_pointer_size('a')
assert_cursor(1)
assert_cursor_max(5)
input_keys('d$')
assert_line('a')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(1)
input_keys('p')
assert_line('abcde')
assert_byte_pointer_size('abcd')
assert_cursor(4)
assert_cursor_max(5)
input_keys('2p')
assert_line('abcdebcdebcde')
assert_byte_pointer_size('abcdebcdebcd')
assert_cursor(12)
assert_cursor_max(13)
end
def test_vi_paste_prev_for_mbchar
input_keys("あいうえお\C-[3h")
assert_line('あいうえお')
assert_byte_pointer_size('あ')
assert_cursor(2)
assert_cursor_max(10)
input_keys('P')
assert_line('あいうえお')
assert_byte_pointer_size('あ')
assert_cursor(2)
assert_cursor_max(10)
input_keys('d$')
assert_line('あ')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(2)
input_keys('P')
assert_line('いうえおあ')
assert_byte_pointer_size('いうえ')
assert_cursor(6)
assert_cursor_max(10)
input_keys('2P')
assert_line('いうえいうえいうえおおおあ')
assert_byte_pointer_size('いうえいうえいうえ')
assert_cursor(18)
assert_cursor_max(26)
end
def test_vi_paste_next_for_mbchar
input_keys("あいうえお\C-[3h")
assert_line('あいうえお')
assert_byte_pointer_size('あ')
assert_cursor(2)
assert_cursor_max(10)
input_keys('p')
assert_line('あいうえお')
assert_byte_pointer_size('あ')
assert_cursor(2)
assert_cursor_max(10)
input_keys('d$')
assert_line('あ')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(2)
input_keys('p')
assert_line('あいうえお')
assert_byte_pointer_size('あいうえ')
assert_cursor(8)
assert_cursor_max(10)
input_keys('2p')
assert_line('あいうえおいうえおいうえお')
assert_byte_pointer_size('あいうえおいうえおいうえ')
assert_cursor(24)
assert_cursor_max(26)
end
def test_vi_paste_prev_for_mbchar_by_plural_code_points
input_keys("\u3099き\u3099く\u3099け\u3099こ\u3099\C-[3h")
assert_line("\u3099き\u3099く\u3099け\u3099こ\u3099")
assert_byte_pointer_size("\u3099")
assert_cursor(2)
assert_cursor_max(10)
input_keys('P')
assert_line("\u3099き\u3099く\u3099け\u3099こ\u3099")
assert_byte_pointer_size("\u3099")
assert_cursor(2)
assert_cursor_max(10)
input_keys('d$')
assert_line("\u3099")
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(2)
input_keys('P')
assert_line("\u3099く\u3099け\u3099こ\u3099か\u3099")
assert_byte_pointer_size("\u3099く\u3099け\u3099")
assert_cursor(6)
assert_cursor_max(10)
input_keys('2P')
assert_line("\u3099く\u3099け\u3099き\u3099く\u3099け\u3099き\u3099く\u3099け\u3099こ\u3099こ\u3099こ\u3099か\u3099")
assert_byte_pointer_size("\u3099く\u3099け\u3099き\u3099く\u3099け\u3099き\u3099く\u3099け\u3099")
assert_cursor(18)
assert_cursor_max(26)
end
def test_vi_paste_next_for_mbchar_by_plural_code_points
input_keys("\u3099き\u3099く\u3099け\u3099こ\u3099\C-[3h")
assert_line("\u3099き\u3099く\u3099け\u3099こ\u3099")
assert_byte_pointer_size("\u3099")
assert_cursor(2)
assert_cursor_max(10)
input_keys('p')
assert_line("\u3099き\u3099く\u3099け\u3099こ\u3099")
assert_byte_pointer_size("\u3099")
assert_cursor(2)
assert_cursor_max(10)
input_keys('d$')
assert_line("\u3099")
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(2)
input_keys('p')
assert_line("\u3099き\u3099く\u3099け\u3099こ\u3099")
assert_byte_pointer_size("\u3099き\u3099く\u3099け\u3099")
assert_cursor(8)
assert_cursor_max(10)
input_keys('2p')
assert_line("\u3099き\u3099く\u3099け\u3099こ\u3099き\u3099く\u3099け\u3099こ\u3099き\u3099く\u3099け\u3099こ\u3099")
assert_byte_pointer_size("\u3099き\u3099く\u3099け\u3099こ\u3099き\u3099く\u3099け\u3099こ\u3099き\u3099く\u3099け\u3099")
assert_cursor(24)
assert_cursor_max(26)
end
def test_vi_prev_next_word
input_keys("aaa b{b}b ccc\C-[0")
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(13)
input_keys('w')
assert_byte_pointer_size('aaa ')
assert_cursor(4)
assert_cursor_max(13)
input_keys('w')
assert_byte_pointer_size('aaa b')
assert_cursor(5)
assert_cursor_max(13)
input_keys('w')
assert_byte_pointer_size('aaa b{')
assert_cursor(6)
assert_cursor_max(13)
input_keys('w')
assert_byte_pointer_size('aaa b{b')
assert_cursor(7)
assert_cursor_max(13)
input_keys('w')
assert_byte_pointer_size('aaa b{b}')
assert_cursor(8)
assert_cursor_max(13)
input_keys('w')
assert_byte_pointer_size('aaa b{b}b ')
assert_cursor(10)
assert_cursor_max(13)
input_keys('w')
assert_byte_pointer_size('aaa b{b}b cc')
assert_cursor(12)
assert_cursor_max(13)
input_keys('b')
assert_byte_pointer_size('aaa b{b}b ')
assert_cursor(10)
assert_cursor_max(13)
input_keys('b')
assert_byte_pointer_size('aaa b{b}')
assert_cursor(8)
assert_cursor_max(13)
input_keys('b')
assert_byte_pointer_size('aaa b{b')
assert_cursor(7)
assert_cursor_max(13)
input_keys('b')
assert_byte_pointer_size('aaa b{')
assert_cursor(6)
assert_cursor_max(13)
input_keys('b')
assert_byte_pointer_size('aaa b')
assert_cursor(5)
assert_cursor_max(13)
input_keys('b')
assert_byte_pointer_size('aaa ')
assert_cursor(4)
assert_cursor_max(13)
input_keys('b')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(13)
input_keys('3w')
assert_byte_pointer_size('aaa b{')
assert_cursor(6)
assert_cursor_max(13)
input_keys('3w')
assert_byte_pointer_size('aaa b{b}b ')
assert_cursor(10)
assert_cursor_max(13)
input_keys('3w')
assert_byte_pointer_size('aaa b{b}b cc')
assert_cursor(12)
assert_cursor_max(13)
input_keys('3b')
assert_byte_pointer_size('aaa b{b')
assert_cursor(7)
assert_cursor_max(13)
input_keys('3b')
assert_byte_pointer_size('aaa ')
assert_cursor(4)
assert_cursor_max(13)
input_keys('3b')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(13)
end
def test_vi_end_word
input_keys("aaa b{b}}}b ccc\C-[0")
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(19)
input_keys('e')
assert_byte_pointer_size('aa')
assert_cursor(2)
assert_cursor_max(19)
input_keys('e')
assert_byte_pointer_size('aaa ')
assert_cursor(6)
assert_cursor_max(19)
input_keys('e')
assert_byte_pointer_size('aaa b')
assert_cursor(7)
assert_cursor_max(19)
input_keys('e')
assert_byte_pointer_size('aaa b{')
assert_cursor(8)
assert_cursor_max(19)
input_keys('e')
assert_byte_pointer_size('aaa b{b}}')
assert_cursor(11)
assert_cursor_max(19)
input_keys('e')
assert_byte_pointer_size('aaa b{b}}}')
assert_cursor(12)
assert_cursor_max(19)
input_keys('e')
assert_byte_pointer_size('aaa b{b}}}b cc')
assert_cursor(18)
assert_cursor_max(19)
input_keys('e')
assert_byte_pointer_size('aaa b{b}}}b cc')
assert_cursor(18)
assert_cursor_max(19)
input_keys('03e')
assert_byte_pointer_size('aaa b')
assert_cursor(7)
assert_cursor_max(19)
input_keys('3e')
assert_byte_pointer_size('aaa b{b}}}')
assert_cursor(12)
assert_cursor_max(19)
input_keys('3e')
assert_byte_pointer_size('aaa b{b}}}b cc')
assert_cursor(18)
assert_cursor_max(19)
end
def test_vi_prev_next_big_word
input_keys("aaa b{b}b ccc\C-[0")
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(13)
input_keys('W')
assert_byte_pointer_size('aaa ')
assert_cursor(4)
assert_cursor_max(13)
input_keys('W')
assert_byte_pointer_size('aaa b{b}b ')
assert_cursor(10)
assert_cursor_max(13)
input_keys('W')
assert_byte_pointer_size('aaa b{b}b cc')
assert_cursor(12)
assert_cursor_max(13)
input_keys('B')
assert_byte_pointer_size('aaa b{b}b ')
assert_cursor(10)
assert_cursor_max(13)
input_keys('B')
assert_byte_pointer_size('aaa ')
assert_cursor(4)
assert_cursor_max(13)
input_keys('B')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(13)
input_keys('2W')
assert_byte_pointer_size('aaa b{b}b ')
assert_cursor(10)
assert_cursor_max(13)
input_keys('2W')
assert_byte_pointer_size('aaa b{b}b cc')
assert_cursor(12)
assert_cursor_max(13)
input_keys('2B')
assert_byte_pointer_size('aaa ')
assert_cursor(4)
assert_cursor_max(13)
input_keys('2B')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(13)
end
def test_vi_end_big_word
input_keys("aaa b{b}}}b ccc\C-[0")
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(19)
input_keys('E')
assert_byte_pointer_size('aa')
assert_cursor(2)
assert_cursor_max(19)
input_keys('E')
assert_byte_pointer_size('aaa b{b}}}')
assert_cursor(12)
assert_cursor_max(19)
input_keys('E')
assert_byte_pointer_size('aaa b{b}}}b cc')
assert_cursor(18)
assert_cursor_max(19)
input_keys('E')
assert_byte_pointer_size('aaa b{b}}}b cc')
assert_cursor(18)
assert_cursor_max(19)
end
def test_ed_quoted_insert
input_keys("ab\C-v\C-acd")
assert_line("ab\C-acd")
assert_byte_pointer_size("ab\C-acd")
assert_cursor(6)
assert_cursor_max(6)
end
def test_ed_quoted_insert_with_vi_arg
input_keys("ab\C-[3\C-v\C-aacd")
assert_line("a\C-a\C-a\C-abcd")
assert_byte_pointer_size("a\C-a\C-a\C-abcd")
assert_cursor(10)
assert_cursor_max(10)
end
def test_vi_delete_next_char
input_keys("abc\C-[h")
assert_byte_pointer_size('a')
assert_cursor(1)
assert_cursor_max(3)
assert_line('abc')
input_keys('x')
assert_byte_pointer_size('a')
assert_cursor(1)
assert_cursor_max(2)
assert_line('ac')
input_keys('x')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(1)
assert_line('a')
input_keys('x')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(0)
assert_line('')
input_keys('x')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(0)
assert_line('')
end
def test_vi_delete_next_char_for_mbchar
input_keys("あいう\C-[h")
assert_byte_pointer_size('あ')
assert_cursor(2)
assert_cursor_max(6)
assert_line('あいう')
input_keys('x')
assert_byte_pointer_size('あ')
assert_cursor(2)
assert_cursor_max(4)
assert_line('あう')
input_keys('x')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(2)
assert_line('あ')
input_keys('x')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(0)
assert_line('')
input_keys('x')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(0)
assert_line('')
end
def test_vi_delete_next_char_for_mbchar_by_plural_code_points
input_keys("\u3099き\u3099く\u3099\C-[h")
assert_byte_pointer_size("\u3099")
assert_cursor(2)
assert_cursor_max(6)
assert_line("\u3099き\u3099く\u3099")
input_keys('x')
assert_byte_pointer_size("\u3099")
assert_cursor(2)
assert_cursor_max(4)
assert_line("\u3099く\u3099")
input_keys('x')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(2)
assert_line("\u3099")
input_keys('x')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(0)
assert_line('')
input_keys('x')
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(0)
assert_line('')
end
def test_vi_delete_prev_char
input_keys('ab')
assert_byte_pointer_size('ab')
assert_cursor(2)
assert_cursor_max(2)
input_keys("\C-h")
assert_byte_pointer_size('a')
assert_cursor(1)
assert_cursor_max(1)
assert_line('a')
end
def test_vi_delete_prev_char_for_mbchar
input_keys('かき')
assert_byte_pointer_size('かき')
assert_cursor(4)
assert_cursor_max(4)
input_keys("\C-h")
assert_byte_pointer_size('か')
assert_cursor(2)
assert_cursor_max(2)
assert_line('か')
end
def test_vi_delete_prev_char_for_mbchar_by_plural_code_points
input_keys("\u3099き\u3099")
assert_byte_pointer_size("\u3099き\u3099")
assert_cursor(4)
assert_cursor_max(4)
input_keys("\C-h")
assert_byte_pointer_size("\u3099")
assert_cursor(2)
assert_cursor_max(2)
assert_line("\u3099")
end
def test_ed_delete_prev_char
input_keys("abcdefg\C-[h")
assert_byte_pointer_size('abcde')
assert_cursor(5)
assert_cursor_max(7)
assert_line('abcdefg')
input_keys('X')
assert_byte_pointer_size('abcd')
assert_cursor(4)
assert_cursor_max(6)
assert_line('abcdfg')
input_keys('3X')
assert_byte_pointer_size('a')
assert_cursor(1)
assert_cursor_max(3)
assert_line('afg')
input_keys('p')
assert_byte_pointer_size('abcd')
assert_cursor(4)
assert_cursor_max(6)
assert_line('afbcdg')
end
def test_ed_delete_prev_word
input_keys('abc def{bbb}ccc')
assert_byte_pointer_size('abc def{bbb}ccc')
assert_cursor(15)
assert_cursor_max(15)
input_keys("\C-w")
assert_byte_pointer_size('abc def{bbb}')
assert_cursor(12)
assert_cursor_max(12)
assert_line('abc def{bbb}')
input_keys("\C-w")
assert_byte_pointer_size('abc def{')
assert_cursor(8)
assert_cursor_max(8)
assert_line('abc def{')
input_keys("\C-w")
assert_byte_pointer_size('abc ')
assert_cursor(4)
assert_cursor_max(4)
assert_line('abc ')
input_keys("\C-w")
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(0)
assert_line('')
end
def test_ed_delete_prev_word_for_mbchar
input_keys('あいう かきく{さしす}たちつ')
assert_byte_pointer_size('あいう かきく{さしす}たちつ')
assert_cursor(27)
assert_cursor_max(27)
input_keys("\C-w")
assert_byte_pointer_size('あいう かきく{さしす}')
assert_cursor(21)
assert_cursor_max(21)
assert_line('あいう かきく{さしす}')
input_keys("\C-w")
assert_byte_pointer_size('あいう かきく{')
assert_cursor(14)
assert_cursor_max(14)
assert_line('あいう かきく{')
input_keys("\C-w")
assert_byte_pointer_size('あいう ')
assert_cursor(7)
assert_cursor_max(7)
assert_line('あいう ')
input_keys("\C-w")
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(0)
assert_line('')
end
def test_ed_delete_prev_word_for_mbchar_by_plural_code_points
input_keys("あいう か\u3099き\u3099く\u3099{さしす}たちつ")
assert_byte_pointer_size("あいう か\u3099き\u3099く\u3099{さしす}たちつ")
assert_cursor(27)
assert_cursor_max(27)
input_keys("\C-w")
assert_byte_pointer_size("あいう か\u3099き\u3099く\u3099{さしす}")
assert_cursor(21)
assert_cursor_max(21)
assert_line("あいう か\u3099き\u3099く\u3099{さしす}")
input_keys("\C-w")
assert_byte_pointer_size("あいう か\u3099き\u3099く\u3099{")
assert_cursor(14)
assert_cursor_max(14)
assert_line("あいう か\u3099き\u3099く\u3099{")
input_keys("\C-w")
assert_byte_pointer_size('あいう ')
assert_cursor(7)
assert_cursor_max(7)
assert_line('あいう ')
input_keys("\C-w")
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(0)
assert_line('')
end
def test_ed_newline_with_cr
input_keys('ab')
assert_byte_pointer_size('ab')
assert_cursor(2)
assert_cursor_max(2)
refute(@line_editor.finished?)
input_keys("\C-m")
assert_line('ab')
assert(@line_editor.finished?)
end
def test_ed_newline_with_lf
input_keys('ab')
assert_byte_pointer_size('ab')
assert_cursor(2)
assert_cursor_max(2)
refute(@line_editor.finished?)
input_keys("\C-j")
assert_line('ab')
assert(@line_editor.finished?)
end
def test_vi_list_or_eof
input_keys('a')
assert_byte_pointer_size('a')
assert_cursor(1)
assert_cursor_max(1)
refute(@line_editor.finished?)
input_keys("\C-d")
assert_line('a')
refute(@line_editor.finished?)
input_keys("\C-h\C-d")
assert_line(nil)
assert(@line_editor.finished?)
end
def test_completion_journey
@line_editor.completion_proc = proc { |word|
%w{
foo_bar
foo_bar_baz
}
}
input_keys('foo')
assert_byte_pointer_size('foo')
assert_cursor(3)
assert_cursor_max(3)
assert_line('foo')
input_keys("\C-n")
assert_byte_pointer_size('foo')
assert_cursor(3)
assert_cursor_max(3)
assert_line('foo')
input_keys("\C-n")
assert_byte_pointer_size('foo_bar')
assert_cursor(7)
assert_cursor_max(7)
assert_line('foo_bar')
input_keys("\C-n")
assert_byte_pointer_size('foo_bar_baz')
assert_cursor(11)
assert_cursor_max(11)
assert_line('foo_bar_baz')
input_keys("\C-n")
assert_byte_pointer_size('foo')
assert_cursor(3)
assert_cursor_max(3)
assert_line('foo')
input_keys("\C-n")
assert_byte_pointer_size('foo_bar')
assert_cursor(7)
assert_cursor_max(7)
assert_line('foo_bar')
input_keys("_\C-n")
assert_byte_pointer_size('foo_bar_')
assert_cursor(8)
assert_cursor_max(8)
assert_line('foo_bar_')
input_keys("\C-n")
assert_byte_pointer_size('foo_bar_baz')
assert_cursor(11)
assert_cursor_max(11)
assert_line('foo_bar_baz')
input_keys("\C-n")
assert_byte_pointer_size('foo_bar_')
assert_cursor(8)
assert_cursor_max(8)
assert_line('foo_bar_')
end
def test_completion_journey_reverse
@line_editor.completion_proc = proc { |word|
%w{
foo_bar
foo_bar_baz
}
}
input_keys('foo')
assert_byte_pointer_size('foo')
assert_cursor(3)
assert_cursor_max(3)
assert_line('foo')
input_keys("\C-p")
assert_byte_pointer_size('foo')
assert_cursor(3)
assert_cursor_max(3)
assert_line('foo')
input_keys("\C-p")
assert_byte_pointer_size('foo_bar_baz')
assert_cursor(11)
assert_cursor_max(11)
assert_line('foo_bar_baz')
input_keys("\C-p")
assert_byte_pointer_size('foo_bar')
assert_cursor(7)
assert_cursor_max(7)
assert_line('foo_bar')
input_keys("\C-p")
assert_byte_pointer_size('foo')
assert_cursor(3)
assert_cursor_max(3)
assert_line('foo')
input_keys("\C-p")
assert_byte_pointer_size('foo_bar_baz')
assert_cursor(11)
assert_cursor_max(11)
assert_line('foo_bar_baz')
input_keys("\C-h\C-p")
assert_byte_pointer_size('foo_bar_ba')
assert_cursor(10)
assert_cursor_max(10)
assert_line('foo_bar_ba')
input_keys("\C-p")
assert_byte_pointer_size('foo_bar_baz')
assert_cursor(11)
assert_cursor_max(11)
assert_line('foo_bar_baz')
input_keys("\C-p")
assert_byte_pointer_size('foo_bar_ba')
assert_cursor(10)
assert_cursor_max(10)
assert_line('foo_bar_ba')
end
def test_completion_journey_in_middle_of_line
@line_editor.completion_proc = proc { |word|
%w{
foo_bar
foo_bar_baz
}
}
input_keys('abcde fo ABCDE')
assert_line('abcde fo ABCDE')
input_keys("\C-[" + 'h' * 5 + "i\C-n")
assert_byte_pointer_size('abcde fo')
assert_cursor(8)
assert_cursor_max(14)
assert_line('abcde fo ABCDE')
input_keys("\C-n")
assert_byte_pointer_size('abcde foo_bar')
assert_cursor(13)
assert_cursor_max(19)
assert_line('abcde foo_bar ABCDE')
input_keys("\C-n")
assert_byte_pointer_size('abcde foo_bar_baz')
assert_cursor(17)
assert_cursor_max(23)
assert_line('abcde foo_bar_baz ABCDE')
input_keys("\C-n")
assert_byte_pointer_size('abcde fo')
assert_cursor(8)
assert_cursor_max(14)
assert_line('abcde fo ABCDE')
input_keys("\C-n")
assert_byte_pointer_size('abcde foo_bar')
assert_cursor(13)
assert_cursor_max(19)
assert_line('abcde foo_bar ABCDE')
input_keys("_\C-n")
assert_byte_pointer_size('abcde foo_bar_')
assert_cursor(14)
assert_cursor_max(20)
assert_line('abcde foo_bar_ ABCDE')
input_keys("\C-n")
assert_byte_pointer_size('abcde foo_bar_baz')
assert_cursor(17)
assert_cursor_max(23)
assert_line('abcde foo_bar_baz ABCDE')
input_keys("\C-n")
assert_byte_pointer_size('abcde foo_bar_')
assert_cursor(14)
assert_cursor_max(20)
assert_line('abcde foo_bar_ ABCDE')
input_keys("\C-n")
assert_byte_pointer_size('abcde foo_bar_baz')
assert_cursor(17)
assert_cursor_max(23)
assert_line('abcde foo_bar_baz ABCDE')
end
def test_ed_move_to_beg
input_keys("abcde\C-[^")
assert_byte_pointer_size('')
assert_cursor(0)
assert_cursor_max(5)
input_keys("0\C-ki")
input_keys(" abcde\C-[^")
assert_byte_pointer_size(' ')
assert_cursor(1)
assert_cursor_max(6)
input_keys("0\C-ki")
input_keys(" abcde ABCDE \C-[^")
assert_byte_pointer_size(' ')
assert_cursor(3)
assert_cursor_max(17)
end
def test_vi_delete_meta
input_keys("aaa bbb ccc ddd eee\C-[02w")
assert_byte_pointer_size('aaa bbb ')
assert_cursor(8)
assert_cursor_max(19)
assert_line('aaa bbb ccc ddd eee')
input_keys('dw')
assert_byte_pointer_size('aaa bbb ')
assert_cursor(8)
assert_cursor_max(15)
assert_line('aaa bbb ddd eee')
input_keys('db')
assert_byte_pointer_size('aaa ')
assert_cursor(4)
assert_cursor_max(11)
assert_line('aaa ddd eee')
end
end

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

@ -1,51 +0,0 @@
require_relative 'helper'
class Reline::KeyStroke::Test < Reline::TestCase
using Module.new {
refine Array do
def as_s
map(&:chr).join
end
end
}
def test_input_to!
config = {
key_mapping: {
"a" => "xx",
"ab" => "y",
"abc" => "z",
"x" => "rr"
}
}
stroke = Reline::KeyStroke.new(config)
result = ("abzwabk".bytes).map { |char|
stroke.input_to!(char)&.then { |result|
"#{result.as_s}"
}
}
assert_equal(result, [nil, nil, "yz", "w", nil, nil, "yk"])
end
def test_input_to
config = {
key_mapping: {
"a" => "xx",
"ab" => "y",
"abc" => "z",
"x" => "rr"
}
}
stroke = Reline::KeyStroke.new(config)
assert_equal(stroke.input_to("a".bytes)&.as_s, nil)
assert_equal(stroke.input_to("ab".bytes)&.as_s, nil)
assert_equal(stroke.input_to("abc".bytes)&.as_s, "z")
assert_equal(stroke.input_to("abz".bytes)&.as_s, "yz")
assert_equal(stroke.input_to("abx".bytes)&.as_s, "yrr")
assert_equal(stroke.input_to("ac".bytes)&.as_s, "rrrrc")
assert_equal(stroke.input_to("aa".bytes)&.as_s, "rrrrrrrr")
assert_equal(stroke.input_to("x".bytes)&.as_s, "rr")
assert_equal(stroke.input_to("m".bytes)&.as_s, "m")
assert_equal(stroke.input_to("abzwabk".bytes)&.as_s, "yzwabk")
end
end

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

@ -1,256 +0,0 @@
require_relative 'helper'
class Reline::KillRing::Test < Reline::TestCase
def setup
@prompt = '> '
@kill_ring = Reline::KillRing.new
end
def test_append_one
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('a')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
assert_equal('a', @kill_ring.yank)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal('a', @kill_ring.yank)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['a', 'a'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['a', 'a'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
end
def test_append_two
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('a')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('b')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
assert_equal('b', @kill_ring.yank)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal('b', @kill_ring.yank)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['a', 'b'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['b', 'a'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
end
def test_append_three
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('a')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('b')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('c')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
assert_equal('c', @kill_ring.yank)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal('c', @kill_ring.yank)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['b', 'c'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['a', 'b'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['c', 'a'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
end
def test_append_three_with_max_two
@kill_ring = Reline::KillRing.new(2)
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('a')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('b')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('c')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
assert_equal('c', @kill_ring.yank)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal('c', @kill_ring.yank)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['b', 'c'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['c', 'b'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['b', 'c'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
end
def test_append_four_with_max_two
@kill_ring = Reline::KillRing.new(2)
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('a')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('b')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('c')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('d')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
assert_equal('d', @kill_ring.yank)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal('d', @kill_ring.yank)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['c', 'd'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['d', 'c'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['c', 'd'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
end
def test_append_after
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('a')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('b')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
assert_equal('ab', @kill_ring.yank)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal('ab', @kill_ring.yank)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['ab', 'ab'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['ab', 'ab'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
end
def test_append_before
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('a')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('b', true)
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
assert_equal('ba', @kill_ring.yank)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal('ba', @kill_ring.yank)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['ba', 'ba'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['ba', 'ba'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
end
def test_append_chain_two
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('a')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('b')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('c')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('d')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
assert_equal('cd', @kill_ring.yank)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal('cd', @kill_ring.yank)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['ab', 'cd'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['cd', 'ab'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
end
def test_append_complex_chain
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('c')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('d')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('b', true)
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('e')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('a', true)
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::FRESH, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('A')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
@kill_ring.append('B')
assert_equal(Reline::KillRing::State::CONTINUED, @kill_ring.instance_variable_get(:@state))
@kill_ring.process
assert_equal(Reline::KillRing::State::PROCESSED, @kill_ring.instance_variable_get(:@state))
assert_equal('AB', @kill_ring.yank)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal('AB', @kill_ring.yank)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['abcde', 'AB'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
assert_equal(['AB', 'abcde'], @kill_ring.yank_pop)
assert_equal(Reline::KillRing::State::YANK, @kill_ring.instance_variable_get(:@state))
end
end