summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortomoya ishida <tomoyapenguin@gmail.com>2024-04-02 01:25:17 +0900
committergit <svn-admin@ruby-lang.org>2024-04-01 16:25:26 +0000
commit508bddc86516ed798365594b70d57e9ec5713e8b (patch)
tree1d418f71411cdd2987a62885769956f225b3828f /test
parente2a1d0b53dddc29b03a535286763fde51d4e089d (diff)
[ruby/reline] Align completion menu items
(https://github.com/ruby/reline/pull/613) https://github.com/ruby/reline/commit/a622704f62
Diffstat (limited to 'test')
-rw-r--r--test/reline/test_line_editor.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/reline/test_line_editor.rb b/test/reline/test_line_editor.rb
index 0963d2c8fe..bf688ac3c6 100644
--- a/test/reline/test_line_editor.rb
+++ b/test/reline/test_line_editor.rb
@@ -127,4 +127,29 @@ class Reline::LineEditor
end
end
end
+
+ def test_menu_info_format
+ list = %w[aa b c d e f g hhh i j k]
+ col3 = [
+ 'aa e i',
+ 'b f j',
+ 'c g k',
+ 'd hhh'
+ ]
+ col2 = [
+ 'aa g',
+ 'b hhh',
+ 'c i',
+ 'd j',
+ 'e k',
+ 'f'
+ ]
+ assert_equal(col3, Reline::LineEditor::MenuInfo.new(list).lines(19))
+ assert_equal(col3, Reline::LineEditor::MenuInfo.new(list).lines(15))
+ assert_equal(col2, Reline::LineEditor::MenuInfo.new(list).lines(14))
+ assert_equal(col2, Reline::LineEditor::MenuInfo.new(list).lines(10))
+ assert_equal(list, Reline::LineEditor::MenuInfo.new(list).lines(9))
+ assert_equal(list, Reline::LineEditor::MenuInfo.new(list).lines(0))
+ assert_equal([], Reline::LineEditor::MenuInfo.new([]).lines(10))
+ end
end