-
-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write specs for new Ruby 2.7 features and changes #745
Comments
@andrykonchin I tried to keep the ones you checked after my last fix for links to issues. Should be fine but would be good if you can double-check. |
@eregon Checked 👍 |
Note for contributors: please mention here which item/checkbox you'd like to add specs for, in order to avoid duplicated work. |
And this looks like completed too
|
How could I cover this one?
As far as I understand there's already a |
@lxxxvi In that case we could just add a new file and check I don't see Arrays being used (as receivers) in https://github.com/ruby/spec/blob/bc1942130ba064d7759f4e91e84ff6b126b2c721/core/enumerable/minmax_spec.rb though, so I think best is to copy that file and adapt to use Arrays. And check |
It seems this case has already been covered in this commit 47be917, can you please check? |
@kuei0221 Indeed, I now checked the box. |
^ PR for
|
61/70 done, we're almost there! |
@eregon Is it time for new Ruby3-related issue? |
I'll try to make one soon. |
Only 2 items left under |
Issue for Ruby 3.0 specs: #823 |
ruby/spec already contains some specs for 2.7, 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:
NOTE: https://rubyreferences.github.io/rubychanges/2.7.html gives more details for many features and changes.
From https://github.com/ruby/ruby/blob/v2_7_0/NEWS:
NEWS for Ruby 2.7.0
This document is a list of user visible feature changes made between
releases except for bug fixes.
Note that each entry is kept so brief that no reason behind or reference
information is supplied with. For a full list of changes with all
sufficient information, see the ChangeLog file or Redmine
(e.g. https://bugs.ruby-lang.org/issues/$FEATURE_OR_BUG_NUMBER).
Changes since the 2.6.0 release
Language changes
Pattern matching
See the following slides for more details:
{-W:no-experimental option}[#label-Warning+option].
The spec of keyword arguments is changed towards 3.0
Non-symbols are allowed as keyword argument keys if the method accepts
arbitrary keywords. Feature #14183
Non-Symbol keys in a keyword arguments hash were prohibited in 2.6.0,
but are now allowed again. Bug #15658
**nil
is allowed in method definitions to explicitly markthat the method accepts no keywords. Calling such a method with keywords
will result in an ArgumentError. Feature #14183
no longer passes an empty hash, unless the empty hash is necessary for
a required parameter, in which case a warning will be emitted. Remove
the double splat to continue passing a positional hash. Feature #14183
Numbered parameters
Numbered parameters as default block parameters are introduced.
Feature #4475
You can still define a local variable named
_1
and so on,and that is honored when present, but renders a warning.
proc/lambda without block is deprecated
Proc.new and Kernel#proc with no block in a method called with a block is
warned now.
This warning can be suppressed with {-W:no-deprecated option}[#label-Warning+option].
Kernel#lambda with no block in a method called with a block raises an exception.
Other miscellaneous changes
A beginless range is experimentally introduced. It might be useful
in
case
, new call-sequence of theComparable#clamp
,constants and DSLs. Feature #14799
Quoted here-document identifiers must end within the same line.
The flip-flop syntax deprecation is reverted. Feature #5400
Comment lines can be placed between fluent dot now.
Calling a private method with a literal
self
as the receiveris now allowed. Feature #11297 Feature #16123
Modifier rescue now operates the same for multiple assignment as single
assignment. Bug #8279
yield
in singleton class syntax is warned and will be deprecated later. Feature #15575.This warning can be suppressed with {-W:no-deprecated option}[#label-Warning+option].
Argument forwarding by
(...)
is introduced. Feature #16253All arguments to
foo
are forwarded tobar
, including keyword andblock arguments.
Note that the parentheses are mandatory.
bar ...
is parsedas an endless range.
Access and setting of
$SAFE
is now always warned.$SAFE
will become a normal global variable in Ruby 3.0. Feature #16131
Object#{taint,untaint,trust,untrust}
and related functions in the C-APIno longer have an effect (all objects are always considered untainted), and are now
warned in verbose mode. This warning will be disabled even in non-verbose mode in
Ruby 3.0, and the methods and C functions will be removed in Ruby 3.2. Feature #16131
Refinements take place at
Object#method
andModule#instance_method
. Feature #15373Command line options
Warning option
The
-W
option has been extended with a following:
, to manage categorizedwarnings. Feature #16345 Feature #16420
To suppress deprecation warnings:
It works with the
RUBYOPT
environment variable:To suppress experimental feature warnings:
To suppress both by using
RUBYOPT
, set space separated values:See also Warning in {Core classes updates}[#label-Core+classes+updates+-28outstanding+ones+only-29].
Core classes updates (outstanding ones only)
Array
Added Array#intersection. Feature #16155
Added Array#minmax, with a faster implementation than Enumerable#minmax. Bug #15929
Comparable
Comparable#clamp now accepts a Range argument. Feature #14784
Complex
So
0 <=> 0i
will not raise NoMethodError. Bug #15857Dir
Use Array instead. Feature #14643
Encoding
Enumerable
Added Enumerable#filter_map. Feature #15323
Added Enumerable#tally. Feature #11076
Enumerator
Added Enumerator.produce to generate an Enumerator from any custom
data transformation. Feature #14781
Added Enumerator::Lazy#eager that generates a non-lazy enumerator
from a lazy enumerator. Feature #15901
Added Enumerator::Yielder#to_proc so that a Yielder object
can be directly passed to another method as a block
argument. Feature #15618
Fiber
exception on the resumed fiber. Feature #10344
File
File.extname now returns a dot string for names ending with a dot on
non-Windows platforms. Bug #15267
FrozenError
modification was attempted. To set this object when raising
FrozenError in Ruby code, FrozenError.new accepts a
:receiver
option. Feature #15751
GC
(MRI-specific) Added GC.compact method for compacting the heap.
This function compacts live objects in the heap so that fewer pages may
be used, and the heap may be more CoW (copy-on-write) friendly. Feature #15626
IO
encoding. Bug #15210
Integer
Integer#[] now supports range operations. Feature #8842
Method
Module
Added Module#const_source_location to retrieve the location where a
constant is defined. Feature #10771
Added Module#ruby2_keywords for marking a method as passing keyword
arguments through a regular argument splat, useful when delegating
all arguments to another method in a way that can be backwards
compatible with older Ruby versions. Bug #16154
Module#autoload? now takes an
inherit
optional argument, likeModule#const_defined?. Feature #15777
Module#name now always returns a frozen String. The returned String is
always the same for a given Module. This change is
experimental. Feature #16150
NilClass / TrueClass / FalseClass
frozen String. The returned String is always the same for each of these
values. This change is experimental. Feature #16150
ObjectSpace::WeakMap
values. Feature #16035
Proc
arguments through a regular argument splat, useful when delegating
all arguments to another method or proc in a way that can be backwards
compatible with older Ruby versions. Feature #16404
Range
Added Range#minmax, with a faster implementation than Enumerable#minmax.
It returns a maximum that now corresponds to Range#max. Bug #15807
Range#=== now uses Range#cover? for String arguments, too (in Ruby 2.6, it was
changed from Range#include? for all types except strings). Bug #15449
String
Update Unicode version and Emoji version from 11.0.0 to
12.0.0. Feature #15321
Update Unicode version to 12.1.0, adding support for
U+32FF SQUARE ERA NAME REIWA. Feature #15195
Update Unicode Emoji version to 12.1. Feature #16272
Symbol
Time
Added Time#ceil method. Feature #15772
Added Time#floor method. Feature #15653
Time#inspect is separated from Time#to_s and it shows
the time's sub second. Feature #15958
UnboundMethod
Added UnboundMethod#bind_call method. Feature #15955
Warning
some categories of warnings. Feature #16345 Feature #16420
$LOAD_PATH
$LOAD_PATH.resolve_feature_path
. Feature #15903 Feature #15230Stdlib updates (outstanding ones only)
to accept
base
keyword. Feature #14405Compatibility issues (excluding feature bug fixes)
Install corresponding gems to use these features.
Proc
Range
It now uses the same algorithm as Range#max. In rare cases (e.g.
ranges of Floats or Strings), this may yield different results. Bug #15807
Stdlib compatibility issues (excluding feature bug fixes)
but not yet published on rubygems.org.
did_you_mean
gem has been promoted up to a default gem from a bundled gempathname
the argument instead of creating a new Pathname. This is more
similar to other Kernel methods, but can break code that modifies
the return value and expects the argument not to be modified.
C API updates
Many
*_kw
functions have been added for setting whetherthe final argument being passed should be treated as keywords. You
may need to switch to these functions to avoid keyword argument
separation warnings, and to ensure correct behavior in Ruby 3.
The
:
character inrb_scan_args
format string is nowtreated as keyword arguments. Passing a positional hash instead of
keyword arguments will emit a deprecation warning.
C API declarations with
ANYARGS
are changed not to useANYARGS
.See Delete ANYARGS ruby#2404
The text was updated successfully, but these errors were encountered: