1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test/irb/test_raise_no_backtrace_exception.rb: fix test file path

Create a file for test under the temporary directory.
This commit is contained in:
Nobuyoshi Nakada 2021-05-18 16:02:56 +09:00
parent 79717f81f8
commit 34bc8210ed
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -29,7 +29,7 @@ IRB
ENV["HOME"] = tmpdir ENV["HOME"] = tmpdir
bundle_exec = ENV.key?('BUNDLE_GEMFILE') ? ['-rbundler/setup'] : [] bundle_exec = ENV.key?('BUNDLE_GEMFILE') ? ['-rbundler/setup'] : []
File.open('euc.rb', 'w') do |f| File.open("#{tmpdir}/euc.rb", 'w') do |f|
f.write(<<~EOF) f.write(<<~EOF)
# encoding: euc-jp # encoding: euc-jp
@ -40,7 +40,9 @@ IRB
end end
env = {} env = {}
%w(LC_MESSAGES LC_ALL LC_CTYPE LANG).each {|n| env[n] = "ja_JP.UTF-8" } %w(LC_MESSAGES LC_ALL LC_CTYPE LANG).each {|n| env[n] = "ja_JP.UTF-8" }
assert_in_out_err([env] + bundle_exec + %w[-rirb -W0 -e IRB.start(__FILE__) -- -f --], <<~IRB, /`raise_euc_with_invalid_byte_sequence': あ\\xFF \(RuntimeError\)/, [], encoding: "UTF-8") args = [env] + bundle_exec + %W[-rirb -C #{tmpdir} -W0 -e IRB.start(__FILE__) -- -f --]
error = /`raise_euc_with_invalid_byte_sequence': あ\\xFF \(RuntimeError\)/
assert_in_out_err(args, <<~IRB, error, [], encoding: "UTF-8")
require_relative 'euc' require_relative 'euc'
raise_euc_with_invalid_byte_sequence raise_euc_with_invalid_byte_sequence
IRB IRB