summaryrefslogtreecommitdiff
path: root/test/reline/yamatanooroti
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2021-10-10 18:58:46 +0900
committergit <svn-admin@ruby-lang.org>2021-10-11 14:10:35 +0900
commit3112e876a17aa750a75d56a7841902bff799b796 (patch)
tree4296142a51c7536f0340df17be3b4e0298ff60aa /test/reline/yamatanooroti
parent391d6ab4f7c3070d0c46dbd7496255d8269f6c1f (diff)
[ruby/reline] Add tests for dialog with fullwidth chars and corner cases
https://github.com/ruby/reline/commit/35ab5d47a8
Diffstat (limited to 'test/reline/yamatanooroti')
-rwxr-xr-xtest/reline/yamatanooroti/multiline_repl9
-rw-r--r--test/reline/yamatanooroti/test_rendering.rb34
2 files changed, 43 insertions, 0 deletions
diff --git a/test/reline/yamatanooroti/multiline_repl b/test/reline/yamatanooroti/multiline_repl
index 2e826793fa..da886b8f06 100755
--- a/test/reline/yamatanooroti/multiline_repl
+++ b/test/reline/yamatanooroti/multiline_repl
@@ -55,6 +55,15 @@ opt.on('--dialog VAL') { |v|
natural to read
and easy to write.
RUBY
+ elsif v.include?('fullwidth')
+ contents = <<~RUBY.split("\n")
+ Rubyとは...
+
+ オープンソースの動的なプログラミン
+ グ言語で、シンプルさと高い生産性を
+ 備えています。エレガントな文法を持
+ ち、自然に読み書きができます。
+ RUBY
end
if v.include?('scrollkey')
dialog.trap_key = nil
diff --git a/test/reline/yamatanooroti/test_rendering.rb b/test/reline/yamatanooroti/test_rendering.rb
index d716ac5a0a..e1dde83589 100644
--- a/test/reline/yamatanooroti/test_rendering.rb
+++ b/test/reline/yamatanooroti/test_rendering.rb
@@ -935,6 +935,40 @@ begin
EOC
end
+ def test_dialog_with_fullwidth_chars
+ ENV['RELINE_TEST_PROMPT'] = '> '
+ start_terminal(30, 5, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --dialog fullwidth,scrollkey,scrollbar}, startup_message: 'Multiline REPL.')
+ 6.times{ write('j') }
+ close
+ assert_screen(<<~'EOC')
+ Multi
+ line
+ REPL.
+ >
+ オー
+ グ言▄
+ 備え█
+ ち、█
+ EOC
+ end
+
+ def test_dialog_with_fullwidth_chars_split
+ ENV['RELINE_TEST_PROMPT'] = '> '
+ start_terminal(30, 6, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --dialog fullwidth,scrollkey,scrollbar}, startup_message: 'Multiline REPL.')
+ 6.times{ write('j') }
+ close
+ assert_screen(<<~'EOC')
+ Multil
+ ine RE
+ PL.
+ >
+ オー
+ グ言 ▄
+ 備え █
+ ち、 █
+ EOC
+ end
+
def test_autocomplete_empty
start_terminal(20, 30, %W{ruby -I#{@pwd}/lib #{@pwd}/test/reline/yamatanooroti/multiline_repl --autocomplete}, startup_message: 'Multiline REPL.')
write('Street')