From 9434a7333c2a23c680a977331a60ca7c502c1ac0 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Sat, 17 Sep 2022 20:19:57 +1200 Subject: Enable coverage for eval. --- spec/ruby/library/coverage/result_spec.rb | 34 +++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'spec/ruby/library') diff --git a/spec/ruby/library/coverage/result_spec.rb b/spec/ruby/library/coverage/result_spec.rb index 4cc43e8462..61283e4545 100644 --- a/spec/ruby/library/coverage/result_spec.rb +++ b/spec/ruby/library/coverage/result_spec.rb @@ -91,15 +91,31 @@ describe 'Coverage.result' do Coverage.result.should_not include(@config_file) end - it 'returns the correct results when eval is used' do - Coverage.start - require @eval_code_file.chomp('.rb') - result = Coverage.result + ruby_version_is '3.1'...'3.2' do + it 'returns the correct results when eval is used' do + Coverage.start + require @eval_code_file.chomp('.rb') + result = Coverage.result - result.should == { - @eval_code_file => [ - 1, nil, 1, nil, 1, nil, nil, nil, nil, nil, 1 - ] - } + result.should == { + @eval_code_file => [ + 1, nil, 1, nil, 1, nil, nil, nil, nil, nil, 1 + ] + } + end + end + + ruby_version_is '3.2' do + it 'returns the correct results when eval is used' do + Coverage.start + require @eval_code_file.chomp('.rb') + result = Coverage.result + + result.should == { + @eval_code_file => [ + 1, nil, 1, nil, 1, 1, nil, nil, nil, nil, 1 + ] + } + end end end -- cgit v1.2.1