ruby / spec

The Ruby Spec Suite aka ruby/spec
MIT License
594 stars 387 forks source link

Write specs for new Ruby 3.0 features and changes #823

Open eregon opened 3 years ago

eregon commented 3 years ago

ruby/spec already contains some specs for 3.0, but we should aim to cover all new features and important changes. This will improve the test coverage of these features (and maybe discover a few bugs along the way), allow other Ruby implementations to implement the changes faster with more confidence and document clearly the new behavior.

The new specs should be within a version guard block:

ruby_version_is "3.0" do
  # New specs
end

NOTE: https://rubyreferences.github.io/rubychanges/3.0.html gives more details for many features and changes.

From https://github.com/ruby/ruby/blob/master/doc/NEWS-3.0.0.md:

NEWS for Ruby 3.0.0

This document is a list of user visible feature changes since the 2.7.0 release, except for bug fixes.

Note that each entry is kept to a minimum, see links for details.

Language changes

Command line options

--help option

--backtrace-limit option

Core classes updates

Outstanding ones only.

Array

Binding

ConditionVariable

Dir

ENV

Encoding

Fiber

GC

Hash

IO

Kernel

Module

Mutex

Proc

Queue / SizedQueue

Ractor

Random

String

Symbol

Fiber

Thread

Warning

Stdlib updates

Set

Socket

Compatibility issues

Excluding feature bug fixes.

Stdlib compatibility issues

C API updates

Implementation improvements

Miscellaneous changes

lxxxvi commented 3 years ago

I think this is already covered and can be marked completed:

Symbol#to_proc now returns a lambda Proc

https://github.com/ruby/spec/blob/7526ccb1ce706a8d6548cdc46d56bf89f1518412/core/symbol/to_proc_spec.rb#L32-L37

andrykonchin commented 3 years ago

Revised the "Language changes" and "Core classes updates" sections and marked items that are already tested.

eregon commented 3 years ago

Thanks!

moofkit commented 2 years ago

Pattern matching (case/in) is no longer experimental. [Feature #17260]

Hi! It looks like already done by this commit https://github.com/ruby/spec/commit/10931592e0f7edb57829d990eed2600d726fb5a2

eregon commented 2 years ago

@moofkit Yes, but that change doesn't check there is no warning in 3.0+ for regular pattern matching (1-line pattern matching is still experimental in 3.0). Could you add a spec in that file that check -> { some pattern matching }.should not_complain for 3.0+?

baweaver commented 2 years ago

I'll take on a few pattern matching items:

baweaver commented 2 years ago

Will wait to go after Feature #16828 until I understand conventions for contributing to this repo.

baweaver commented 2 years ago

Feature#16378 (Argument forwarding with leading arg) had been completed by the following commit:

https://github.com/ruby/spec/commit/b089bf7817d1fbe76d1ab752cb3744724bb2a825

JuanCrg90 commented 2 years ago

@eregon

Hash#except has been added, which returns a hash excluding the given keys and their values. [Feature #15822]

Is already implemented on : https://github.com/ruby/spec/pull/786

JuanCrg90 commented 2 years ago

@eregon

Random::DEFAULT now refers to the Random class instead of being a Random instance, so it can work with Ractor. [Feature #17322]

And

Random::DEFAULT is deprecated since its value is now confusing and it is no longer global, use Kernel.rand/Random.rand directly, or create a Random instance with Random.new instead. [Feature #17351]

Are already implemented on: https://github.com/ruby/spec/commit/25d878a7b4

eregon commented 2 years ago

@JuanCrg90 Thanks! I noted those as done.

JuanCrg90 commented 2 years ago

@eregon

Warning Warning#warn now supports a category keyword argument. [Feature #17122]

Was already implemented on: https://github.com/ruby/spec/commit/05ff9d434c

eregon commented 2 years ago

@marcandre I wonder, do you have specs for Ractor? I know you wrote https://github.com/marcandre/backports/tree/master/lib/backports/ractor. Or maybe you used CRuby tests to check it?

marcandre commented 2 years ago

@eregon, oops, missed that notification, sorry.

Yes, I used CRuby tests to check my backport (and I was glad to have them all pass, except those that were checking that MovedError or similar).

herwinw commented 1 year ago

The "Core classes updates" has two sections named "Fiber". The second one is in between "Symbol" and "Thread". The last item of the second section is "Thread#join invokes the scheduler hooks block/unblock in a non-blocking execution context", this should probably be moved to "Thread" (similar to "ConditionVariable" and "Queue / SizedQueue")