ruby / spec

The Ruby Spec Suite aka ruby/spec
MIT License
600 stars 389 forks source link

Add shared specs when precision is passed in for Integer#floor, Float#floor and Integer#ceil, Float#ceil #1186

Closed peterzhu2118 closed 4 months ago

peterzhu2118 commented 4 months ago

There is poor spec coverage of when precision is passed into Integer#floor, Float#floor, Integer#ceil, Float#ceil. This PR adds some specs for when precision is passed in.

peterzhu2118 commented 4 months ago

Note that cases where self has fewer digits than precision is omitted, due to issues that is fixed in https://github.com/ruby/ruby/pull/11257.

eregon commented 4 months ago

Note that cases where self has fewer digits than precision is omitted, due to issues that is fixed in ruby/ruby#11257.

Could you include those too, but under ruby_bug "#20654", ""..."3.4" do?

BTW it's fine if you change specs directly in the ruby/ruby PR for convenience, that ensures the specs are run with the fix and work on ruby-head.

peterzhu2118 commented 4 months ago

BTW it's fine if you change specs directly in the ruby/ruby PR for convenience, that ensures the specs are run with the fix and work on ruby-head.

Yep, I'll add the specs for the new behaviour in https://github.com/ruby/ruby/pull/11257 once this PR is merged.

eregon commented 4 months ago

Thanks for the new specs!