summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-10-28 16:35:00 +0900
committergit <svn-admin@ruby-lang.org>2022-10-28 08:29:38 +0000
commit13e968c1cdd2da470173e2cc15b44ebb936be534 (patch)
treeeceba4ba106931ba8b251ceba30c7ca4df93d8d4 /test
parent7440fc3eb4ee6409f2204523c8c9875d8e80a208 (diff)
[ruby/irb] Suppress sequence to inspect asian ambiguous width
https://github.com/ruby/irb/commit/a7097c5b80
Diffstat (limited to 'test')
-rw-r--r--test/irb/test_cmd.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/irb/test_cmd.rb b/test/irb/test_cmd.rb
index e330aa3a44..060f70c9cc 100644
--- a/test/irb/test_cmd.rb
+++ b/test/irb/test_cmd.rb
@@ -113,7 +113,17 @@ module TestIRB
East\sAsian\sAmbiguous\sWidth:\s\d\n
#{@is_win ? 'Code\spage:\s\d+\n' : ''}
}x
- assert_match expected, irb.context.main.irb_info.to_s
+ info = irb.context.main.irb_info
+ capture_output do
+ # Reline::Core#ambiguous_width may access STDOUT, not $stdout
+ stdout = STDOUT.dup
+ STDOUT.reopen(IO::NULL, "w")
+ info = info.to_s
+ ensure
+ STDOUT.reopen(stdout)
+ stdout.close
+ end
+ assert_match expected, info
ensure
ENV["LANG"] = lang_backup
ENV["LC_ALL"] = lc_all_backup