Skip to content

Commit 35ab5d4

Browse files
committed
Add tests for dialog with fullwidth chars and corner cases
1 parent de858ee commit 35ab5d4

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

test/reline/yamatanooroti/multiline_repl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ opt.on('--dialog VAL') { |v|
5555
natural to read
5656
and easy to write.
5757
RUBY
58+
elsif v.include?('fullwidth')
59+
contents = <<~RUBY.split("\n")
60+
Rubyとは...
61+
62+
オープンソースの動的なプログラミン
63+
グ言語で、シンプルさと高い生産性を
64+
備えています。エレガントな文法を持
65+
ち、自然に読み書きができます。
66+
RUBY
5867
end
5968
if v.include?('scrollkey')
6069
dialog.trap_key = nil

test/reline/yamatanooroti/test_rendering.rb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,40 @@ def test_simple_dialog_scrollbar_with_moving_to_left
935935
EOC
936936
end
937937

938+
def test_dialog_with_fullwidth_chars
939+
ENV['RELINE_TEST_PROMPT'] = '> '
940+
start_terminal(30, 5, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --dialog fullwidth,scrollkey,scrollbar}, startup_message: 'Multiline REPL.')
941+
6.times{ write('j') }
942+
close
943+
assert_screen(<<~'EOC')
944+
Multi
945+
line
946+
REPL.
947+
>
948+
オー
949+
グ言▄
950+
備え█
951+
ち、█
952+
EOC
953+
end
954+
955+
def test_dialog_with_fullwidth_chars_split
956+
ENV['RELINE_TEST_PROMPT'] = '> '
957+
start_terminal(30, 6, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --dialog fullwidth,scrollkey,scrollbar}, startup_message: 'Multiline REPL.')
958+
6.times{ write('j') }
959+
close
960+
assert_screen(<<~'EOC')
961+
Multil
962+
ine RE
963+
PL.
964+
>
965+
オー
966+
グ言 ▄
967+
備え █
968+
ち、 █
969+
EOC
970+
end
971+
938972
def test_autocomplete_empty
939973
start_terminal(20, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --autocomplete}, startup_message: 'Multiline REPL.')
940974
write('Street')

0 commit comments

Comments
 (0)