Skip to content

Write specs for new Ruby 2.5 features and changes #565

@eregon

Description

@eregon

ruby/spec already contains many specs for 2.5, 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 "2.5" do
  # New specs
end

From https://github.com/ruby/ruby/blob/trunk/NEWS.
Only relevant items are kept for brevity.

NEWS for Ruby 2.5.0

Changes since the 2.4.0 release

Language changes

Core classes updates (outstanding ones only)

Array

Data

  • Is deprecated. It was a base class for C extensions, and it's not
    necessary to expose in Ruby level. Feature #3072

Exception

  • Exception#full_message to retrieve a String expression of an exception,
    formatted in the same way in which Ruby prints out an uncaught exception.
    Feature #14141 [experimental]

Dir

Enumerable

  • Enumerable#{any?,all?,none?,one?} accept a pattern argument Feature #11286

File

  • File.open accepts :newline option to imply text mode. Bug #13350
  • File#path raises an IOError for files opened with
    File::Constants::TMPFILE option. Feature #13568
  • File::Stat#{atime,mtime,ctime} support fractional second timestamps on
    Windows 8 and later Feature #13726
  • File::Stat#ino and File.indentical? support ReFS 128bit ino on Windows 8.1
    and later Feature #13731
  • File.lutime Feature #4052

Hash

IO

IOError

  • IO#close might raise an error with message "stream closed",
    but it is refined to "stream closed in another thread". The new message
    is more clear for user.
    Bug #13405

Integer

Kernel

Method

  • Method#=== that invokes Method#call, as same as Proc#=== Feature #14142

Module

  • Module#{attr,attr_accessor,attr_reader,attr_writer} become public Feature #14132
  • Module#{define_method,alias_method,undef_method,remove_method} become public Feature #14133

Numeric

  • Numerical comparison operators (<,<=,>=,>) no longer hide exceptions
    from #coerce method internally. Return nil in #coerce if the coercion is
    impossible. Feature #7688

Process

Range

  • Range#initialize no longer hides exceptions when comparing begin and
    end with #<=> and raise a "bad value for range" ArgumentError
    but instead lets the exception from the #<=> call go through.
    Feature #7688

Regexp

String

Struct

  • Struct.new takes keyword_init: true option to initialize members
    with keyword arguments. Feature #11925

  • Regexp/String: Update Unicode version from 9.0.0 to 10.0.0 Feature #13685

Thread

  • Thread#fetch Feature #13009
  • The default of Thread.report_on_exception is now true,
    showing unhandled exceptions terminating threads on $stderr.
    Feature #14143

Time

  • Time#at receives 3rd argument which specifies the unit of 2nd argument.
    Feature #13919

KeyError

FrozenError

Stdlib updates

Only stdlib which do not have tests are listed.
Many stdlib live in their own projects with their own tests.

RbConfig

  • RbConfig::LIMITS is added to provide the limits of C types.
    This is available when rbconfig/sizeof is loaded.

Compatibility issues (excluding feature bug fixes)

Socket

  • BasicSocket#read_nonblock and BasicSocket#write_nonblock no
    longer set the O_NONBLOCK file description flag as side effect
    (on Linux only) Feature #13362

Random

  • Random.raw_seed renamed to become Random.urandom. It is now
    applicable to non-seeding purposes due to Bug #9569.

Stdlib compatibility issues (excluding feature bug fixes)

mathn.rb

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions