1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/spec/ruby
nobu 0faf018624 Bug Fix Enumerator::Lazy#uniq state for multiple call
* enumerator.c (lazy_uniq_i): create new hash for each calls.
  [Fix GH-1820]

Currently

	2.5.0-preview1 :001 > arr = (0..100).lazy.uniq{|i| i % 10}
	 => #<Enumerator::Lazy: #<Enumerator::Lazy: 0..100>:uniq>
	2.5.0-preview1 :002 > arr.to_a
	 => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
	2.5.0-preview1 :003 > arr.to_a
	 => []

Expected

arr.to_a to always return same output

From: Anmol Chopra <anmolchopra@rocketbox.in>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-13 01:00:08 +00:00
..
command_line Update to ruby/spec@c1b568b 2018-03-04 15:09:32 +00:00
core Bug Fix Enumerator::Lazy#uniq state for multiple call 2018-03-13 01:00:08 +00:00
fixtures Update to ruby/spec@c1b568b 2018-03-04 15:09:32 +00:00
language Update to ruby/spec@c1b568b 2018-03-04 15:09:32 +00:00
library Update to ruby/spec@c1b568b 2018-03-04 15:09:32 +00:00
optional/capi Update to ruby/spec@c1b568b 2018-03-04 15:09:32 +00:00
security Update to ruby/spec@c1b568b 2018-03-04 15:09:32 +00:00
shared Update to ruby/spec@c1b568b 2018-03-04 15:09:32 +00:00
.gitignore
.rubocop.yml Update to ruby/spec@83063a3 2018-01-29 16:08:16 +00:00
.rubocop_todo.yml Update to ruby/spec@83063a3 2018-01-29 16:08:16 +00:00
.travis.yml Update to ruby/spec@0fe33ac 2017-12-27 16:12:47 +00:00
appveyor.yml Update to ruby/spec@691755d 2017-09-28 09:19:59 +00:00
CHANGES.before-2008-05-10
CONTRIBUTING.md Update to ruby/spec@cbe855c 2018-02-27 20:21:25 +00:00
default.mspec
LICENSE
README.md Update to ruby/spec@cbe855c 2018-02-27 20:21:25 +00:00
spec_helper.rb Update to ruby/spec@bacedc5 2017-12-01 15:41:50 +00:00
TODO

The Ruby Spec Suite

Build Status Build Status Gitter

The Ruby Spec Suite is a test suite for the behavior of the Ruby programming language.

It is not a standardized specification like the ISO one, and does not aim to become one. Instead, it is a practical tool to describe and test the behavior of Ruby with code.

Every example code has a textual description, which presents several advantages:

  • It is easier to understand the intent of the author
  • It documents how recent versions of Ruby should behave
  • It helps Ruby implementations to agree on a common behavior

The specs are written with syntax similar to RSpec 2. They are run with MSpec, the purpose-built framework for running the Ruby Spec Suite. For more information, see the MSpec project.

The specs describe the language syntax, the core library, the standard library, the C API for extensions and the command line flags. The language specs are grouped by keyword while the core and standard library specs are grouped by class and method.

ruby/spec is known to be tested in these implementations for every commit:

ruby/spec describes the behavior of Ruby 2.2 and more recent Ruby versions. More precisely, every latest stable MRI release passes all specs of ruby/spec (latest 2.2.x, 2.3.x, 2.4.x, etc).

For older specs try these commits:

Running the specs

First, clone this repository:

$ git clone https://github.com/ruby/spec.git

Then move to it:

$ cd spec

Clone MSpec:

$ git clone https://github.com/ruby/mspec.git ../mspec

And run the spec suite:

$ ../mspec/bin/mspec

This will execute all the specs using the executable named ruby on your current PATH.

Running Specs with a Specific Ruby Implementation

Use the -t option to specify the Ruby implementation with which to run the specs. The argument may be a full path to the Ruby binary.

$ ../mspec/bin/mspec -t /path/to/some/bin/ruby

Running Selected Specs

To run a single spec file, pass the filename to mspec:

$ ../mspec/bin/mspec core/kernel/kind_of_spec.rb

You can also pass a directory, in which case all specs in that directories will be run:

$ ../mspec/bin/mspec core/kernel

Finally, you can also run them per group as defined in default.mspec. The following command will run all language specs:

$ ../mspec/bin/mspec :language

In similar fashion, the following commands run the respective specs:

$ ../mspec/bin/mspec :core
$ ../mspec/bin/mspec :library
$ ../mspec/bin/mspec :capi

Contributing

See CONTRIBUTING.md.

History and RubySpec

This project was originally born from Rubinius tests being converted to the spec style. These specs were later extracted to their own project, RubySpec, with a specific vision and principles. At the end of 2014, Brian Shirai, the creator of RubySpec, decided to end RubySpec. A couple months later, the different repositories were merged and the project was revived. On 12 January 2016, the name was changed to "The Ruby Spec Suite" for clarity and to let the RubySpec ideology rest in peace.