summaryrefslogtreecommitdiff
path: root/bootstraptest/test_eval.rb
diff options
context:
space:
mode:
authorYuta Saito <[email protected]>2021-12-13 16:48:57 +0900
committerYusuke Endoh <[email protected]>2021-12-16 16:16:40 +0900
commit332d1e52e62735ff16e5fb9207ce86695369555d ()
treebbf05dd6dae54073ed81c405436d69673311358b /bootstraptest/test_eval.rb
parent69a7eaae389b49eb2a99c1c44c11b3d5004d186f (diff)
btest: assign $stderr = STDOUT instead of IO#reopen to be more portable
`IO#reopen` internally uses dup syscall but some platforms don't support the syscall. re-assigning `$stderr` is enough to capture the interpreter's errors and warnings.
Notes: Merged: https://.com/ruby/ruby/pull/5255
-rw-r--r--bootstraptest/test_eval.rb4
1 files changed, 2 insertions, 2 deletions
@@ -218,7 +218,7 @@ assert_equal %q{[10, main]}, %q{
%w[break next redo].each do |keyword|
assert_match %r"Can't escape from eval with #{keyword}\b", %{
- STDERR.reopen(STDOUT)
begin
eval "0 rescue #{keyword}"
rescue SyntaxError => e
@@ -228,7 +228,7 @@ assert_equal %q{[10, main]}, %q{
end
assert_normal_exit %q{
- STDERR.reopen(STDOUT)
class Foo
def self.add_method
class_eval("def some-bad-name; puts 'hello' unless @some_variable.some_function(''); end")