Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7dc05f0643d3
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5236ec1e6f06
Choose a head ref

Commits on Jan 22, 2016

  1. Copy the full SHA
    05d88aa View commit details

Commits on Jan 23, 2016

  1. Copy the full SHA
    fa397f8 View commit details

Commits on Jan 25, 2016

  1. Copy the full SHA
    991206b View commit details
  2. Copy the full SHA
    d0f82ef View commit details
  3. Copy the full SHA
    da529d1 View commit details
  4. Copy the full SHA
    c5dcaf0 View commit details

Commits on Jan 28, 2016

  1. Reword spec description

    jsyeo committed Jan 28, 2016
    Copy the full SHA
    ae134d8 View commit details
  2. Copy the full SHA
    05f6818 View commit details
  3. Copy the full SHA
    c136f19 View commit details
  4. Merge pull request #3584 from jsyeo/jsyeo-slice-failing-specs

    Fix issue in slice_(after|before) when iterator method yields more than one value
    jsyeo committed Jan 28, 2016
    Copy the full SHA
    70ed311 View commit details
  5. Copy the full SHA
    570428e View commit details
  6. Copy the full SHA
    3854fe5 View commit details
  7. Merge pull request #3591 from jsyeo/jsyeo-count-yield-multi

    Fix count when enumerable yields multiple values
    jsyeo committed Jan 28, 2016
    Copy the full SHA
    36eee9e View commit details
  8. Use rubinius-ast-2.4.

    brixen committed Jan 28, 2016
    Copy the full SHA
    c3e4476 View commit details
  9. Copy the full SHA
    a7ba16d View commit details

Commits on Jan 29, 2016

  1. Spec Enumerable#sort_by when #map does not return an array

    The basic example for this is a lazy enumerable.  In this case, #map
    returns another lazy enumerable, and this breaks #sort_by
    asppsa committed Jan 29, 2016
    Copy the full SHA
    efc8f03 View commit details
  2. Copy the full SHA
    341890e View commit details
  3. Merge pull request #3593 from asppsa/master

    Fix Enumerable#sort_by when #map does not return an array
    brixen committed Jan 29, 2016
    Copy the full SHA
    74a7dbd View commit details
  4. Updated rubinius-code gems.

    brixen committed Jan 29, 2016
    Copy the full SHA
    90c9577 View commit details
  5. Copy the full SHA
    6bdb060 View commit details
  6. Wrapped/cleaned up README.md

    Yorick Peterse committed Jan 29, 2016
    Copy the full SHA
    0171748 View commit details
  7. Added RubyGems license files

    Yorick Peterse committed Jan 29, 2016
    Copy the full SHA
    490fb77 View commit details
  8. Added udis86 license file

    Yorick Peterse committed Jan 29, 2016
    Copy the full SHA
    e1bbed0 View commit details
  9. Added winpthreads license

    Yorick Peterse committed Jan 29, 2016
    Copy the full SHA
    07475cc View commit details
  10. Added explicit license file for zlib

    Yorick Peterse committed Jan 29, 2016
    Copy the full SHA
    dd6f367 View commit details
  11. Clarified what is covered by what license

    Fixes #3590
    Yorick Peterse committed Jan 29, 2016
    Copy the full SHA
    e517891 View commit details

Commits on Jan 30, 2016

  1. Copy the full SHA
    646112c View commit details
  2. re-enable partial support for IO finalizer and autoclose

    The IO finalizer is tricky since it also has to detect possible
    modifications from C API calls. There will likely need to be
    some rework done on the C API code itself to make this easier
    to manage from the Ruby side since we are trying to get as much
    as possible out of C/C++.
    chuckremes committed Jan 30, 2016
    Copy the full SHA
    bb2f9b2 View commit details
  3. Copy the full SHA
    5236ec1 View commit details
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -6,4 +6,4 @@ gem "redcard", "~> 1.0"
gem "daedalus-core", "~> 0.1"
gem "rubinius-bridge", "~> 1.0"

gem "rubinius-build_tools", "~> 2.0"
gem "rubinius-code", "~> 3"
2 changes: 1 addition & 1 deletion Gemfile.installed
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ gem "bundler", "~> 1.7"
gem "redcard", "~> 1.0"
gem "daedalus-core", "~> 0.1"

gem "rubinius-build_tools", "~> 2.0"
gem "rubinius-code", "~> 3"
gem "rubinius-developer_tools", "~> 2.0"

gem "rubysl", "~> 2.2"
26 changes: 14 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -4,19 +4,21 @@ GEM
daedalus-core (0.5.0)
rake (10.5.0)
redcard (1.1.0)
rubinius-ast (2.3.2)
rubinius-ast (3.0)
rubinius-bridge (1.1.0)
redcard (~> 1.0)
rubinius-build_tools (2.0.0)
rubinius-ast (~> 2.0)
rubinius-compiler (~> 2.0)
rubinius-melbourne (~> 2.0)
rubinius-processor (~> 2.0)
rubinius-toolset (~> 2.0)
rubinius-compiler (2.3.1)
rubinius-melbourne (2.3.1.0)
rubinius-processor (2.3.0)
rubinius-toolset (2.3.1)
rubinius-code (3.0)
rubinius-ast (~> 3)
rubinius-compiler (~> 3)
rubinius-instructions (~> 3)
rubinius-melbourne (~> 3)
rubinius-processor (~> 3)
rubinius-toolset (~> 3)
rubinius-compiler (3.0)
rubinius-instructions (3.0)
rubinius-melbourne (3.0)
rubinius-processor (3.0)
rubinius-toolset (3.0)

PLATFORMS
ruby
@@ -26,7 +28,7 @@ DEPENDENCIES
rake (~> 10.0)
redcard (~> 1.0)
rubinius-bridge (~> 1.0)
rubinius-build_tools (~> 2.0)
rubinius-code (~> 3)

BUNDLED WITH
1.11.2
13 changes: 10 additions & 3 deletions README
Original file line number Diff line number Diff line change
@@ -40,9 +40,16 @@ The following Ruby features are not supported on Rubinius:

4. License

Rubinius uses the MPL-2.0 license. See LICENSE for details. Contributions made
prior to January 3rd, 2016 are licensed under the old BSD 3-clause license. A
copy of this license can be found in the file "BSD_LICENSE".
All source code in this repository is subject to the terms of the Mozilla Public
License, version 2.0 unless stated otherwise. A copy of this license can be
found the file "LICENSE" or at https://www.mozilla.org/MPL/2.0/.

Contributions made prior to January 3rd, 2016 are licensed under the old BSD
3-clause license. A copy of this license can be found in the file "BSD_LICENSE".

In the event a directory contains a "LICENSE", "LICENSE.txt" or "COPYING" file
the license specified in said file applies to the contents of said directory and
all sub directories, overwriting the licenses specified above.

5. Installing Rubinius from Source

60 changes: 37 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,12 +2,15 @@

## The Rubinius Language Platform

Rubinius is a modern language platform that supports a number of programming languages.
Rubinius is a modern language platform that supports a number of programming
languages.

Rubinius includes a bytecode virtual machine, generational garbage collector, and just-in-time (JIT) native machine code compiler. Rubinius provides concurrency support via native OS threads with no global interpreter lock.

Rubinius runs on Mac OS X and many Unix/Linux operating systems. Microsoft Windows is not yet supported.
Rubinius includes a bytecode virtual machine, generational garbage collector,
and just-in-time (JIT) native machine code compiler. Rubinius provides
concurrency support via native OS threads with no global interpreter lock.

Rubinius runs on Mac OS X and many Unix/Linux operating systems. Microsoft
Windows is not yet supported.

### Code of Conduct

@@ -35,47 +38,58 @@ The following Ruby features are not supported on Rubinius:
* Refinements
* $SAFE levels


### License

Rubinius uses the MPL-2.0 license. See LICENSE for details. Contributions made
prior to January 3rd, 2016 are licensed under the old BSD 3-clause license. A
copy of this license can be found in the file "BSD_LICENSE".
All source code in this repository is subject to the terms of the Mozilla Public
License, version 2.0 unless stated otherwise. A copy of this license can be
found the file "LICENSE" or at <https://www.mozilla.org/MPL/2.0/>.

Contributions made prior to January 3rd, 2016 are licensed under the old BSD
3-clause license. A copy of this license can be found in the file "BSD_LICENSE".

In the event a directory contains a "LICENSE", "LICENSE.txt" or "COPYING" file
the license specified in said file applies to the contents of said directory and
all sub directories, overwriting the licenses specified above.

### Installing Rubinius from Source

To install Rubinius, use the following steps:

1. Ensure that MRI 2.0+, rubygems, rake, git and LLVM are installed
1. git clone git://github.com/rubinius/rubinius.git
1. cd rubinius
1. bundle
1. ./configure --prefix=/path/to/install/dir
1. rake

When the install process finishes, follow the directions printed to the terminal to add the Rubinius executable (bin) directory to your PATH. For more information see the documentation for [Build Requirements](http://rubinius.com/doc/en/getting-started/requirements/) and [Building Rubinius](http://rubinius.com/doc/en/getting-started/building/).

2. git clone git://github.com/rubinius/rubinius.git
3. cd rubinius
4. bundle
5. ./configure --prefix=/path/to/install/dir
6. rake

When the install process finishes, follow the directions printed to the terminal
to add the Rubinius executable (bin) directory to your PATH. For more
information see the documentation for
[Build Requirements](http://rubinius.com/doc/en/getting-started/requirements/)
and [Building Rubinius](http://rubinius.com/doc/en/getting-started/building/).

### Using RubyGems

Rubinius comes with RubyGems built-in. To install a gem, run the following:

$ rbx -S gem install <gem_name>


### Documentation

The Rubinius documentation is available at the [Rubinius website](http://rubinius.com).

The Rubinius documentation is available at the [Rubinius
website](http://rubinius.com).

### Issues & Support

Please [file tickets](http://github.com/rubinius/rubinius/issues) for bugs or problems.

For additional help, visit the [Rubinius Gitter chat room](https://gitter.im/rubinius/rubinius).
Please [file tickets](http://github.com/rubinius/rubinius/issues) for bugs or
problems.

For additional help, visit the
[Rubinius Gitter chat room](https://gitter.im/rubinius/rubinius).

### Contributing

The Rubinius team welcomes contributions. For more information, read the
[CONTRIBUTING](https://github.com/rubinius/rubinius/blob/master/CONTRIBUTING.md) file and see the documentation [about contributing](http://rubinius.com/doc/en/contributing/).
[CONTRIBUTING](https://github.com/rubinius/rubinius/blob/master/CONTRIBUTING.md)
file and see the documentation
[about contributing](http://rubinius.com/doc/en/contributing/).
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
@@ -163,7 +163,7 @@ class Configure
@vendored_libdir = File.join(root, "/vendor")

# Ruby compatibility version
@ruby_version = "2.2.0"
@ruby_version = "2.2.2"
@ruby_libversion = @ruby_version.split(/\./)[0..1].join.to_i

# Configure settings
15 changes: 8 additions & 7 deletions gems_list.txt
Original file line number Diff line number Diff line change
@@ -9,17 +9,18 @@ rake-10.5.0.gem
rb-readline-0.5.3.gem
rdoc-4.2.1.gem
redcard-1.1.0.gem
rubinius-ast-2.3.2.gem
rubinius-ast-3.0.gem
rubinius-bridge-1.1.0.gem
rubinius-build_tools-2.0.0.gem
rubinius-compiler-2.3.1.gem
rubinius-code-3.0.gem
rubinius-compiler-3.0.gem
rubinius-coverage-2.0.3.gem
rubinius-debugger-2.2.1.gem
rubinius-developer_tools-2.0.0.gem
rubinius-melbourne-2.3.1.0.gem
rubinius-processor-2.3.0.gem
rubinius-instructions-3.0.gem
rubinius-melbourne-3.0.gem
rubinius-processor-3.0.gem
rubinius-profiler-2.0.2.gem
rubinius-toolset-2.3.1.gem
rubinius-toolset-3.0.gem
rubysl-2.2.0.gem
rubysl-abbrev-2.0.4.gem
rubysl-base64-2.0.0.gem
@@ -70,9 +71,9 @@ rubysl-net-smtp-2.0.1.gem
rubysl-net-telnet-2.0.0.gem
rubysl-nkf-2.0.1.gem
rubysl-observer-2.0.0.gem
rubysl-open-uri-2.0.0.gem
rubysl-open3-2.0.0.gem
rubysl-openssl-2.8.0.gem
rubysl-open-uri-2.0.0.gem
rubysl-optparse-2.0.1.gem
rubysl-ostruct-2.1.0.gem
rubysl-pathname-2.1.0.gem
5 changes: 2 additions & 3 deletions kernel/common/array.rb
Original file line number Diff line number Diff line change
@@ -1144,9 +1144,8 @@ def product(*args)
outer_lambda.call([])

if block_given?
block_result = self
result.each { |v| block_result << yield(v) }
block_result
result.each { |v| yield(v) }
self
else
result
end
13 changes: 9 additions & 4 deletions kernel/common/enumerable.rb
Original file line number Diff line number Diff line change
@@ -53,7 +53,10 @@ def collect
def count(item = undefined)
seq = 0
if !undefined.equal?(item)
each { |element| seq += 1 if item == element }
each do
element = Rubinius.single_block_arg
seq += 1 if item == element
end
elsif block_given?
each { |element| seq += 1 if yield(element) }
else
@@ -140,7 +143,8 @@ def slice_before(pattern = undefined, &block)

Enumerator.new do |yielder|
accumulator = nil
each do |element|
each do
element = Rubinius.single_block_arg
start_new = block.yield(element)
if start_new
yielder.yield accumulator if accumulator
@@ -164,7 +168,8 @@ def slice_after(pattern = undefined, &block)

Enumerator.new do |yielder|
accumulator = nil
each do |element|
each do
element = Rubinius.single_block_arg
end_chunk = block.yield(element)
accumulator ||= []
if end_chunk
@@ -350,7 +355,7 @@ def sort_by
sort_values = map do
element = Rubinius.single_block_arg
SortedElement.new(element, yield(element))
end
end.to_a

# Now sort the tuple according to the sort by value
sort_values.sort!
63 changes: 56 additions & 7 deletions kernel/common/io.rb
Original file line number Diff line number Diff line change
@@ -190,14 +190,22 @@ def initialize(fd, stat)
end

@sync = true
@autoclose = false
reset_positioning(@stat)

# Don't bother to add finalization for stdio
if @descriptor >= 3
# finalize
# Sometimes a FileDescriptor class is replaced (see IO#reopen) so we need to be
# careful we don't finalize that descriptor. Probably need a way to cancel
# the finalization when we are transferring an FD from one instance to another.
ObjectSpace.define_finalizer(self, method(:finalizer))
end
end

def autoclose=(bool)
@autoclose = bool
end

def descriptor
@descriptor
end
@@ -556,6 +564,34 @@ def inspect
stat = Stat.fstat(@descriptor)
"fd [#{descriptor}], mode [#{@mode}], total_size [#{@total_size}], offset [#{@offset}], eof [#{@eof}], stat.size [#{stat.size}], written? [#{@written}]"
end

def cancel_finalizer
ObjectSpace.undefine_finalizer(self)
end

def finalizer
return if @descriptor.nil? || @descriptor == -1

fd = @descriptor

# Should flush a write buffer here if one exists. Current
# implementation does not buffer writes internally, so this
# is a no-op.

# Do not close stdin/out/err (0, 1, and 2)
if @descriptor > 3
@descriptor = -1

# Take care of any IO cleanup for the C API here. An IO may
# have been promoted to a low-level RIO struct using #fdopen,
# so we MUST use #fclose to clost it.

# no op for now

# Ignore any return code... don't care if it fails
FFI::Platform::POSIX.close(fd) if @autoclose
end
end
end # class FileDescriptor

class BufferedFileDescriptor < FileDescriptor
@@ -1647,8 +1683,13 @@ def self.setup(io, fd, mode=nil, sync=false)
end
end

fd_obj = FileDescriptor.choose_type(fd)
io.fd = fd_obj
# Check the given +io+ for a valid fd instance first. If it has one, don't
# allocate another because we could double up on finalizers for the same
# fd. Only allocate one here if +fd+ ivar is nil.
if io.instance_variable_get(:@fd).nil?
fd_obj = FileDescriptor.choose_type(fd)
io.instance_variable_set(:@fd, fd_obj)
end
io.mode = mode || cur_mode
io.sync = !!sync

@@ -1676,9 +1717,10 @@ def initialize(fd, mode=undefined, options=undefined)
mode, binary, external, internal, @autoclose = IO.normalize_options(mode, options)

fd = Rubinius::Type.coerce_to fd, Integer, :to_int
@fd = BufferedFileDescriptor.choose_type(fd)
@fd = FileDescriptor.choose_type(fd)
raise "FD could not be allocated for fd [#{fd}]" unless @fd
raise "No descriptor set for fd [#{fd}]" unless @fd.descriptor
autoclose = @autoclose
IO.setup self, fd, mode
@lineno = 0

@@ -1730,6 +1772,7 @@ def initialize_copy(original_io) # :nodoc:
dest_io.mode = original_io.mode
dest_io.sync = original_io.sync
dest_io.binmode if original_io.binmode?
dest_io.autoclose = original_io.autoclose

dest_io
end
@@ -1810,12 +1853,17 @@ def advise(advice, offset = 0, len = 0)
nil
end

def autoclose
@autoclose
end

def autoclose?
@autoclose
end

def autoclose=(autoclose)
@autoclose = !!autoclose
def autoclose=(bool)
@fd.autoclose = bool
@autoclose = !!bool
end

def binmode
@@ -2944,6 +2992,7 @@ def reopen(other, mode=undefined)

# When reopening we may be going from a Pipe to a File or vice versa. Let the
# system figure out the proper FD class.
@fd.cancel_finalizer # cancel soon-to-be-overwritten instance's finalizer
@fd = FileDescriptor.choose_type(descriptor)
Rubinius::Unsafe.set_class self, io.class
if io.respond_to?(:path)
@@ -2967,7 +3016,6 @@ def reopen(other, mode=undefined)
end

reopen_path Rubinius::Type.coerce_to_path(other), mode
@fd = FileDescriptor.choose_type(descriptor)

unless closed?
seek(0, SEEK_SET) rescue Errno::ESPIPE
@@ -2979,6 +3027,7 @@ def reopen(other, mode=undefined)

def reopen_path(path, mode)
status = @fd.reopen_path(path, mode)
@fd.cancel_finalizer
@fd = FileDescriptor.choose_type(descriptor)
return status
end
4 changes: 2 additions & 2 deletions kernel/common/random.rb
Original file line number Diff line number Diff line change
@@ -66,9 +66,9 @@ def random_integer(limit)
end

def random_range(limit)
min, max = limit.max.coerce(limit.min)
min, max = limit.last.coerce(limit.first)
diff = max - min
diff += 1 if max.kind_of?(Integer)
diff += 1 if max.kind_of?(Integer) && !limit.exclude_end?
random(diff) + min
end

10 changes: 5 additions & 5 deletions kernel/delta/code_loader.rb
Original file line number Diff line number Diff line change
@@ -131,13 +131,13 @@ def load_compiler
$LOAD_PATH.unshift dir
end

require_compiled "rubinius/toolset"
require_compiled "rubinius/code/toolset"

Rubinius::ToolSets.create :runtime do
require_compiled "rubinius/melbourne"
require_compiled "rubinius/processor"
require_compiled "rubinius/compiler"
require_compiled "rubinius/ast"
require_compiled "rubinius/code/melbourne"
require_compiled "rubinius/code/processor"
require_compiled "rubinius/code/compiler"
require_compiled "rubinius/code/ast"
end
rescue Object => e
raise LoadError, "Unable to load the bytecode compiler", e
54 changes: 54 additions & 0 deletions library/rubygems/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
RubyGems is copyrighted free software by Chad Fowler, Rich Kilmer, Jim
Weirich and others. You can redistribute it and/or modify it under
either the terms of the MIT license (see the file MIT.txt), or the
conditions below:

1. You may make and give away verbatim copies of the source form of the
software without restriction, provided that you duplicate all of the
original copyright notices and associated disclaimers.

2. You may modify your copy of the software in any way, provided that
you do at least ONE of the following:

a. place your modifications in the Public Domain or otherwise
make them Freely Available, such as by posting said
modifications to Usenet or an equivalent medium, or by allowing
the author to include your modifications in the software.

b. use the modified software only within your corporation or
organization.

c. give non-standard executables non-standard names, with
instructions on where to get the original software distribution.

d. make other distribution arrangements with the author.

3. You may distribute the software in object code or executable
form, provided that you do at least ONE of the following:

a. distribute the executables and library files of the software,
together with instructions (in the manual page or equivalent)
on where to get the original distribution.

b. accompany the distribution with the machine-readable source of
the software.

c. give non-standard executables non-standard names, with
instructions on where to get the original software distribution.

d. make other distribution arrangements with the author.

4. You may modify and include the part of the software into any other
software (possibly commercial).

5. The scripts and library files supplied as input to or produced as
output from the software do not automatically fall under the
copyright of the software, but belong to whomever generated them,
and may be sold commercially, and may be aggregated with this
software.

6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.

21 changes: 21 additions & 0 deletions library/rubygems/MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Copyright (c) Chad Fowler, Rich Kilmer, Jim Weirich and others.
Portions copyright (c) Engine Yard and Andre Arko

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion rakelib/gems.rake
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ namespace :gems do

task :melbourne do
prefix = "#{BUILD_CONFIG[:build_prefix]}#{BUILD_CONFIG[:runtimedir]}"
path = Dir["#{prefix}/gems/rubinius-melbourne-*/ext/rubinius/melbourne"].first
path = Dir["#{prefix}/gems/rubinius-melbourne-*/ext/rubinius/code/melbourne"].first
Dir.chdir path do
begin
ENV["RBX_RUN_COMPILED"] = "1"
10 changes: 5 additions & 5 deletions rakelib/kernel.rake
Original file line number Diff line number Diff line change
@@ -223,13 +223,13 @@ namespace :compiler do

task :load => ['compiler:generate'] do
require "rubinius/bridge"
require "rubinius/toolset"
require "rubinius/code/toolset"

Rubinius::ToolSets.create :build do
require "rubinius/melbourne"
require "rubinius/processor"
require "rubinius/compiler"
require "rubinius/ast"
require "rubinius/code/melbourne"
require "rubinius/code/processor"
require "rubinius/code/compiler"
require "rubinius/code/ast"
end

require File.expand_path("../../kernel/signature", __FILE__)
6 changes: 6 additions & 0 deletions spec/ruby/core/array/product_spec.rb
Original file line number Diff line number Diff line change
@@ -41,6 +41,12 @@
acc.should be_empty
end

it "returns self" do
a = [1, 2, 3].freeze

a.product([1, 2]) { |p| p.first }.should == a
end

it "will ignore unreasonable numbers of products and yield anyway" do
a = (0..100).to_a
lambda do
13 changes: 10 additions & 3 deletions spec/ruby/core/enumerable/count_spec.rb
Original file line number Diff line number Diff line change
@@ -43,8 +43,15 @@ def size
@numerous.count(4){|x| x%2==0 }.should == 1
end

it "gathers initial args as elements when each yields multiple" do
multi = EnumerableSpecs::YieldsMulti.new
multi.count {|e| e == 1 }.should == 1
describe "when each yields multiple values" do
it "gathers initial args as elements" do
multi = EnumerableSpecs::YieldsMulti.new
multi.count {|e| e == 1 }.should == 1
end

it "accepts an argument for comparison using ==" do
multi = EnumerableSpecs::YieldsMulti.new
multi.count([1, 2]).should == 1
end
end
end
29 changes: 29 additions & 0 deletions spec/ruby/core/enumerable/fixtures/classes.rb
Original file line number Diff line number Diff line change
@@ -300,4 +300,33 @@ def to_a
super.freeze
end
end

class MapReturnsEnumerable
include Enumerable

class EnumerableMapping
include Enumerable

def initialize(items, block)
@items = items
@block = block
end

def each
@items.each do |i|
yield @block.call(i)
end
end
end

def each
yield 1
yield 2
yield 3
end

def map(&block)
EnumerableMapping.new(self, block)
end
end
end # EnumerableSpecs utility classes
8 changes: 8 additions & 0 deletions spec/ruby/core/enumerable/slice_after_spec.rb
Original file line number Diff line number Diff line change
@@ -46,6 +46,14 @@
end
end

describe "when an iterator method yields more than one value" do
it "processes all yielded values" do
enum = EnumerableSpecs::YieldsMulti.new
result = enum.slice_after { |i| i == [3, 4, 5] }.to_a
result.should == [[[1, 2], [3, 4, 5]], [[6, 7, 8, 9]]]
end
end

it "raises an ArgumentError when given an incorrect number of arguments" do
lambda { @enum.slice_after("one", "two") }.should raise_error(ArgumentError)
lambda { @enum.slice_after }.should raise_error(ArgumentError)
8 changes: 8 additions & 0 deletions spec/ruby/core/enumerable/slice_before_spec.rb
Original file line number Diff line number Diff line change
@@ -52,6 +52,14 @@
lambda { @enum.slice_before }.should raise_error(ArgumentError)
end

describe "when an iterator method yields more than one value" do
it "processes all yielded values" do
enum = EnumerableSpecs::YieldsMulti.new
result = enum.slice_before { |i| i == [3, 4, 5] }.to_a
result.should == [[[1, 2]], [[3, 4, 5], [6, 7, 8, 9]]]
end
end

before :all do
@method_args = [3]
end
5 changes: 5 additions & 0 deletions spec/ruby/core/enumerable/sort_by_spec.rb
Original file line number Diff line number Diff line change
@@ -27,5 +27,10 @@
multi.sort_by {|e| e.size}.should == [[1, 2], [3, 4, 5], [6, 7, 8, 9]]
end

it "returns an array of elements when a block is supplied and #map returns an enumerable" do
b = EnumerableSpecs::MapReturnsEnumerable.new
b.sort_by{ |x| -x }.should == [3, 2, 1]
end

it_behaves_like :enumerable_enumeratorized_with_origin_size, :sort_by
end
2 changes: 1 addition & 1 deletion spec/ruby/core/io/tty_spec.rb
Original file line number Diff line number Diff line change
@@ -8,6 +8,6 @@
describe "IO#ttyname" do
it "returns the name of the STDOUT tty" do
io = $stdout
io.ttyname.should =~ /dev\/tty/
io.ttyname.should =~ Regexp.new('/dev/')
end
end
68 changes: 66 additions & 2 deletions spec/ruby/core/kernel/rand_spec.rb
Original file line number Diff line number Diff line change
@@ -49,8 +49,72 @@
rand l
end

it "returns a float for an range argument where max is < 1" do
rand(0.25..0.75).should be_kind_of(Float)
context "given an exclusive range" do
it "returns an Integer between the two Integers" do
1000.times do
x = rand(4...6)
x.should be_kind_of(Integer)
(4...6).should include(x)
end
end

it "returns a Float between the given Integer and Float" do
1000.times do
x = rand(4...6.5)
x.should be_kind_of(Float)
(4...6.5).should include(x)
end
end

it "returns a Float between the given Float and Integer" do
1000.times do
x = rand(3.5...6)
x.should be_kind_of(Float)
(3.5...6).should include(x)
end
end

it "returns a Float between the two given Floats" do
1000.times do
x = rand(3.5...6.5)
x.should be_kind_of(Float)
(3.5...6.5).should include(x)
end
end
end

context "given an inclusive range" do
it "returns an Integer between the two Integers" do
1000.times do
x = rand(4..6)
x.should be_kind_of(Integer)
(4..6).should include(x)
end
end

it "returns a Float between the given Integer and Float" do
1000.times do
x = rand(4..6.5)
x.should be_kind_of(Float)
(4..6.5).should include(x)
end
end

it "returns a Float between the given Float and Integer" do
1000.times do
x = rand(3.5..6)
x.should be_kind_of(Float)
(3.5..6).should include(x)
end
end

it "returns a Float between the two given Floats" do
1000.times do
x = rand(3.5..6.5)
x.should be_kind_of(Float)
(3.5..6.5).should include(x)
end
end
end
end

6 changes: 6 additions & 0 deletions spec/ruby/language/fixtures/super.rb
Original file line number Diff line number Diff line change
@@ -340,5 +340,11 @@ def foo(**)
super
end
end

class C < A
def foo(a:, b: 'b', **)
super
end
end
end
end
6 changes: 6 additions & 0 deletions spec/ruby/language/super_spec.rb
Original file line number Diff line number Diff line change
@@ -166,6 +166,12 @@ def a(arg)
b.foo(:number => 10).should == {:number => 10}
end

it "passes any given keyword arguments including optional and required ones to the parent" do
c = Super::KeywordArguments::C.new

c.foo(a: 'a', c: 'c').should == {a: 'a', b: 'b', c: 'c'}
end

it 'does not pass any keyword arguments to the parent when none are given' do
b = Super::KeywordArguments::B.new

1 change: 1 addition & 0 deletions spec/tags/ruby/language/super_tags.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
fails:The super keyword raises a RuntimeError when called with implicit arguments from a method defined with define_method
fails:The super keyword invokes methods from a chain of anonymous modules
fails:The super keyword when using keyword arguments does not pass any keyword arguments to the parent when none are given
fails:The super keyword when using keyword arguments passes any given keyword arguments including optional and required ones to the parent
22 changes: 22 additions & 0 deletions vendor/udis86/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2002-2012, Vivek Thampi <vivek.mt@gmail.com>
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 changes: 43 additions & 0 deletions vendor/winpthreads/COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
With exception of certain parts that are prominently marked as being
in the Public Domain, BSD, or LGPL this Software is provided under the
Zope Public License (ZPL) Version 2.1.

Copyright (c) 2009 - 2013 by the mingw-w64 project

See the AUTHORS file for the list of contributors to the mingw-w64 project.

This license has been certified as open source. It has also been designated
as GPL compatible by the Free Software Foundation (FSF).

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions in source code must retain the accompanying copyright
notice, this list of conditions, and the following disclaimer.
2. Redistributions in binary form must reproduce the accompanying
copyright notice, this list of conditions, and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
3. Names of the copyright holders must not be used to endorse or promote
products derived from this software without prior written permission
from the copyright holders.
4. The right to distribute this software or to use it for any purpose does
not give you the right to use Servicemarks (sm) or Trademarks (tm) of
the copyright holders. Use of them is covered by separate agreement
with the copyright holders.
5. If any files are modified, you must cause the modified files to carry
prominent notices stating that you changed the files and the date of
any change.

Disclaimer

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20 changes: 20 additions & 0 deletions vendor/zlib/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(C) 1995-2013 Jean-loup Gailly and Mark Adler

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu