summaryrefslogtreecommitdiff
path: root/spec/ruby/library/coverage/start_spec.rb
diff options
authorAndrew Konchin <[email protected]>2025-05-07 13:08:11 +0300
committerBenoit Daloze <[email protected]>2025-05-09 23:22:15 +0200
commit269ad29de95e41cc8a4eede84b98a81a6ff4f7b6 (patch)
tree150acf5f6d6c2d401dd46b84b942af26b3699cc9 /spec/ruby/library/coverage/start_spec.rb
parent3135eddb4e8c6975b6fa5345f15fdaa55257851a (diff)
Update to ruby/spec@d8bacef
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13265
Diffstat (limited to 'spec/ruby/library/coverage/start_spec.rb')
-rw-r--r--spec/ruby/library/coverage/start_spec.rb114
1 files changed, 56 insertions, 58 deletions
diff --git a/spec/ruby/library/coverage/start_spec.rb b/spec/ruby/library/coverage/start_spec.rb
index 757837a462..c921b85401 100644
--- a/spec/ruby/library/coverage/start_spec.rb
+++ b/spec/ruby/library/coverage/start_spec.rb
@@ -27,63 +27,61 @@ describe 'Coverage.start' do
}.should raise_error(RuntimeError, 'coverage measurement is already setup')
end
- ruby_version_is '3.2' do
- it "accepts :all optional argument" do
- Coverage.start(:all)
- Coverage.should.running?
- end
-
- it "accepts lines: optional keyword argument" do
- Coverage.start(lines: true)
- Coverage.should.running?
- end
-
- it "accepts branches: optional keyword argument" do
- Coverage.start(branches: true)
- Coverage.should.running?
- end
-
- it "accepts methods: optional keyword argument" do
- Coverage.start(methods: true)
- Coverage.should.running?
- end
-
- it "accepts eval: optional keyword argument" do
- Coverage.start(eval: true)
- Coverage.should.running?
- end
-
- it "accepts oneshot_lines: optional keyword argument" do
- Coverage.start(oneshot_lines: true)
- Coverage.should.running?
- end
-
- it "ignores unknown keyword arguments" do
- Coverage.start(foo: true)
- Coverage.should.running?
- end
-
- it "expects a Hash if not passed :all" do
- -> {
- Coverage.start(42)
- }.should raise_error(TypeError, "no implicit conversion of Integer into Hash")
- end
-
- it "does not accept both lines: and oneshot_lines: keyword arguments" do
- -> {
- Coverage.start(lines: true, oneshot_lines: true)
- }.should raise_error(RuntimeError, "cannot enable lines and oneshot_lines simultaneously")
- end
-
- it "enables the coverage measurement if passed options with `false` value" do
- Coverage.start(lines: false, branches: false, methods: false, eval: false, oneshot_lines: false)
- Coverage.should.running?
- end
-
- it "measures coverage within eval" do
- Coverage.start(lines: true, eval: true)
- eval("Object.new\n"*3, binding, "test.rb", 1)
- Coverage.result["test.rb"].should == {lines: [1, 1, 1]}
- end
+ it "accepts :all optional argument" do
+ Coverage.start(:all)
+ Coverage.should.running?
+ end
+
+ it "accepts lines: optional keyword argument" do
+ Coverage.start(lines: true)
+ Coverage.should.running?
+ end
+
+ it "accepts branches: optional keyword argument" do
+ Coverage.start(branches: true)
+ Coverage.should.running?
+ end
+
+ it "accepts methods: optional keyword argument" do
+ Coverage.start(methods: true)
+ Coverage.should.running?
+ end
+
+ it "accepts eval: optional keyword argument" do
+ Coverage.start(eval: true)
+ Coverage.should.running?
+ end
+
+ it "accepts oneshot_lines: optional keyword argument" do
+ Coverage.start(oneshot_lines: true)
+ Coverage.should.running?
+ end
+
+ it "ignores unknown keyword arguments" do
+ Coverage.start(foo: true)
+ Coverage.should.running?
+ end
+
+ it "expects a Hash if not passed :all" do
+ -> {
+ Coverage.start(42)
+ }.should raise_error(TypeError, "no implicit conversion of Integer into Hash")
+ end
+
+ it "does not accept both lines: and oneshot_lines: keyword arguments" do
+ -> {
+ Coverage.start(lines: true, oneshot_lines: true)
+ }.should raise_error(RuntimeError, "cannot enable lines and oneshot_lines simultaneously")
+ end
+
+ it "enables the coverage measurement if passed options with `false` value" do
+ Coverage.start(lines: false, branches: false, methods: false, eval: false, oneshot_lines: false)
+ Coverage.should.running?
+ end
+
+ it "measures coverage within eval" do
+ Coverage.start(lines: true, eval: true)
+ eval("Object.new\n"*3, binding, "test.rb", 1)
+ Coverage.result["test.rb"].should == {lines: [1, 1, 1]}
end
end