Skip to content

Commit

Permalink
Merge branch 'master' into truffle-head
Browse files Browse the repository at this point in the history
Conflicts:
	truffle/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java
  • Loading branch information
chrisseaton committed Mar 25, 2015
2 parents a228a03 + 3855ace commit 05d79cb
Show file tree
Hide file tree
Showing 589 changed files with 5,781 additions and 9,464 deletions.
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/RubyGlobal.java
Expand Up @@ -124,7 +124,6 @@ public static void createGlobals(ThreadContext context, Ruby runtime) {
runtime.defineGlobalConstant("RUBY_PATCHLEVEL", patchlevel);
runtime.defineGlobalConstant("RUBY_RELEASE_DATE", release);
runtime.defineGlobalConstant("RUBY_PLATFORM", platform);
runtime.defineGlobalConstant("RUBY_ENGINE", engine);

IRubyObject description = runtime.newString(OutputStrings.getVersionString()).freeze(context);
runtime.defineGlobalConstant("RUBY_DESCRIPTION", description);
Expand All @@ -142,6 +141,8 @@ public static void createGlobals(ThreadContext context, Ruby runtime) {

// needs to be a fixnum, but our revision is a sha1 hash from git
runtime.defineGlobalConstant("RUBY_REVISION", runtime.newFixnum(Constants.RUBY_REVISION));
runtime.defineGlobalConstant("RUBY_ENGINE", engine);
runtime.defineGlobalConstant("RUBY_ENGINE_VERSION", jrubyVersion);

RubyInstanceConfig.Verbosity verbosity = runtime.getInstanceConfig().getVerbosity();
runtime.defineVariable(new WarningGlobalVariable(runtime, "$-W", verbosity), GLOBAL);
Expand Down
9 changes: 9 additions & 0 deletions spec/jruby/compat_spec.rb
@@ -0,0 +1,9 @@
describe "Cross-platform compatibility" do
it "defines RUBY_ENGINE" do
expect(defined?(RUBY_ENGINE)).to_not eq nil
end

it "defines RUBY_ENGINE_VERSION" do
expect(defined?(RUBY_ENGINE_VERSION)).to_not eq nil
end
end
2 changes: 0 additions & 2 deletions spec/mspec/.travis.yml
@@ -1,8 +1,6 @@
language: ruby
script:
- bundle exec rspec
jdk:
- openjdk7
rvm:
- 1.8.7
- 1.9.3
Expand Down
16 changes: 8 additions & 8 deletions spec/mspec/Gemfile.lock
Expand Up @@ -8,14 +8,14 @@ GEM
specs:
diff-lcs (1.2.5)
rake (10.4.2)
rspec (2.99.0)
rspec-core (~> 2.99.0)
rspec-expectations (~> 2.99.0)
rspec-mocks (~> 2.99.0)
rspec-core (2.99.2)
rspec-expectations (2.99.2)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.8)
rspec-expectations (2.14.5)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.99.3)
rspec-mocks (2.14.6)

PLATFORMS
java
Expand All @@ -24,4 +24,4 @@ PLATFORMS
DEPENDENCIES
mspec!
rake (~> 10.0)
rspec (~> 2.8)
rspec (~> 2.14.1)
3 changes: 1 addition & 2 deletions spec/mspec/lib/mspec/runner/actions/tally.rb
Expand Up @@ -62,10 +62,9 @@ def tag
end

def format
results = [ file, example, expectation, failure, error ]
results = [ file, example, expectation, failure, error, tag ]
if [:report, :report_on, :verify].any? { |m| MSpec.mode? m }
results << guard
results << tag
end
results.join(", ")
end
Expand Down
6 changes: 3 additions & 3 deletions spec/mspec/mspec.gemspec
Expand Up @@ -27,14 +27,14 @@ MSpec attempts to use the simplest Ruby language features
so that beginning Ruby implementations can run it.
EOS
gem.has_rdoc = true
gem.extra_rdoc_files = %w[ README LICENSE ]
gem.extra_rdoc_files = %w[ README.md LICENSE ]
gem.rubygems_version = %q{1.3.5}
gem.rubyforge_project = 'http://rubyforge.org/projects/mspec'

gem.rdoc_options << '--title' << 'MSpec Gem' <<
'--main' << 'README' <<
'--main' << 'README.md' <<
'--line-numbers'

gem.add_development_dependency "rake", "~> 10.0"
gem.add_development_dependency "rspec", "~> 2.8"
gem.add_development_dependency "rspec", "~> 2.14.1"
end
4 changes: 2 additions & 2 deletions spec/mspec/spec/commands/mspec_spec.rb
Expand Up @@ -143,7 +143,7 @@
Finished in 42 seconds
2 files, 2 examples, 4 expectations, 0 failures, 0 errors
2 files, 2 examples, 4 expectations, 0 failures, 0 errors, 0 tagged
]
end

Expand Down Expand Up @@ -174,7 +174,7 @@
Finished in 42 seconds
1 file, 1 example, 2 expectations, 0 failures, 0 errors
1 file, 1 example, 2 expectations, 0 failures, 0 errors, 0 tagged
]
end
end
Expand Down
13 changes: 8 additions & 5 deletions spec/mspec/spec/runner/actions/tally_spec.rb
Expand Up @@ -180,7 +180,8 @@
@tally.examples! 2
@tally.expectations! 4
@tally.errors!
@tally.format.should == "1 file, 2 examples, 4 expectations, 0 failures, 1 error"
@tally.tagged!
@tally.format.should == "1 file, 2 examples, 4 expectations, 0 failures, 1 error, 1 tagged"
end

it "includes guards if MSpec is in verify mode" do
Expand All @@ -189,9 +190,10 @@
@tally.examples! 2
@tally.expectations! 4
@tally.errors!
@tally.tagged!
@tally.guards!
@tally.format.should ==
"1 file, 2 examples, 4 expectations, 0 failures, 1 error, 1 guard, 0 tagged"
"1 file, 2 examples, 4 expectations, 0 failures, 1 error, 1 tagged, 1 guard"
end

it "includes guards if MSpec is in report mode" do
Expand All @@ -200,9 +202,10 @@
@tally.examples! 2
@tally.expectations! 4
@tally.errors!
@tally.tagged!
@tally.guards! 2
@tally.format.should ==
"1 file, 2 examples, 4 expectations, 0 failures, 1 error, 2 guards, 0 tagged"
"1 file, 2 examples, 4 expectations, 0 failures, 1 error, 1 tagged, 2 guards"
end

it "includes guards if MSpec is in report_on mode" do
Expand All @@ -213,7 +216,7 @@
@tally.errors!
@tally.guards! 2
@tally.format.should ==
"1 file, 2 examples, 4 expectations, 0 failures, 1 error, 2 guards, 0 tagged"
"1 file, 2 examples, 4 expectations, 0 failures, 1 error, 0 tagged, 2 guards"
end
end

Expand Down Expand Up @@ -312,7 +315,7 @@
@tally.expectation @state
exc = ExceptionState.new nil, nil, SpecExpectationNotMetError.new("Failed!")
@tally.exception exc
@tally.format.should == "1 file, 1 example, 2 expectations, 1 failure, 0 errors"
@tally.format.should == "1 file, 1 example, 2 expectations, 1 failure, 0 errors, 0 tagged"
end
end

Expand Down
6 changes: 3 additions & 3 deletions spec/mspec/spec/runner/formatters/describe_spec.rb
Expand Up @@ -37,7 +37,7 @@

it "prints a tally of counts" do
@formatter.finish
@out.should =~ /^1 file, 1 example, 2 expectations, 0 failures, 0 errors$/
@out.should =~ /^1 file, 1 example, 2 expectations, 0 failures, 0 errors, 0 tagged$/
end

it "does not print exceptions" do
Expand All @@ -46,7 +46,7 @@
Finished in 2.0 seconds
1 file, 1 example, 2 expectations, 0 failures, 0 errors
1 file, 1 example, 2 expectations, 0 failures, 0 errors, 0 tagged
]
end

Expand All @@ -61,7 +61,7 @@
Finished in 2.0 seconds
1 file, 1 example, 2 expectations, 0 failures, 0 errors
1 file, 1 example, 2 expectations, 0 failures, 0 errors, 0 tagged
]
end
end
10 changes: 4 additions & 6 deletions spec/ruby/core/argf/close_spec.rb
Expand Up @@ -26,12 +26,10 @@

ruby_version_is ""..."2.3" do
# This passes on 1.9 and 1.8 HEAD, but fails on 1.8.7 and 1.8.6
ruby_bug "#1633", "1.8.7.174" do
it "raises an IOError if called on a closed stream" do
argv [@file1_name] do
lambda { ARGF.close }.should_not raise_error
lambda { ARGF.close }.should raise_error(IOError)
end
it "raises an IOError if called on a closed stream" do
argv [@file1_name] do
lambda { ARGF.close }.should_not raise_error
lambda { ARGF.close }.should raise_error(IOError)
end
end
end
Expand Down
16 changes: 7 additions & 9 deletions spec/ruby/core/argf/lineno_spec.rb
Expand Up @@ -26,15 +26,13 @@
end
end

ruby_bug "#1693", "1.8" do
it "resets to 0 after the stream is rewound" do
argv [@file1, @file2, @file1, @file2] do
ARGF.lineno = 0
ARGF.lineno.should == 0
ARGF.readline
ARGF.rewind
ARGF.lineno.should == 0
end
it "resets to 0 after the stream is rewound" do
argv [@file1, @file2, @file1, @file2] do
ARGF.lineno = 0
ARGF.lineno.should == 0
ARGF.readline
ARGF.rewind
ARGF.lineno.should == 0
end
end

Expand Down
16 changes: 7 additions & 9 deletions spec/ruby/core/argf/rewind_spec.rb
Expand Up @@ -28,15 +28,13 @@
end
end

ruby_bug "#1693", "1.8" do
it "resets ARGF.lineno to 0" do
argv [@file2_name] do
ARGF.lineno = 0
ARGF.gets;
ARGF.lineno.should > 0
ARGF.rewind;
ARGF.lineno.should == 0
end
it "resets ARGF.lineno to 0" do
argv [@file2_name] do
ARGF.lineno = 0
ARGF.gets;
ARGF.lineno.should > 0
ARGF.rewind;
ARGF.lineno.should == 0
end
end

Expand Down
28 changes: 12 additions & 16 deletions spec/ruby/core/array/comparison_spec.rb
Expand Up @@ -64,21 +64,19 @@
(lhs <=> rhs).should == +1
end

ruby_bug "#", "1.8.6.277" do
it "properly handles recursive arrays" do
empty = ArraySpecs.empty_recursive_array
(empty <=> empty).should == 0
(empty <=> []).should == 1
([] <=> empty).should == -1
it "properly handles recursive arrays" do
empty = ArraySpecs.empty_recursive_array
(empty <=> empty).should == 0
(empty <=> []).should == 1
([] <=> empty).should == -1

(ArraySpecs.recursive_array <=> []).should == 1
([] <=> ArraySpecs.recursive_array).should == -1
(ArraySpecs.recursive_array <=> []).should == 1
([] <=> ArraySpecs.recursive_array).should == -1

(ArraySpecs.recursive_array <=> ArraySpecs.empty_recursive_array).should == nil
(ArraySpecs.recursive_array <=> ArraySpecs.empty_recursive_array).should == nil

array = ArraySpecs.recursive_array
(array <=> array).should == 0
end
array = ArraySpecs.recursive_array
(array <=> array).should == 0
end

it "tries to convert the passed argument to an Array using #to_ary" do
Expand All @@ -93,9 +91,7 @@
([5, 6, 7] <=> obj).should == 0
end

ruby_bug "redmine:2276", "1.9.1" do
it "returns nil when the argument is not array-like" do
([] <=> false).should be_nil
end
it "returns nil when the argument is not array-like" do
([] <=> false).should be_nil
end
end
54 changes: 22 additions & 32 deletions spec/ruby/core/array/fill_spec.rb
Expand Up @@ -54,9 +54,7 @@
it "raises an ArgumentError if 4 or more arguments are passed when no block given" do
lambda { [].fill('a') }.should_not raise_error(ArgumentError)

ruby_bug "#", "1.8.6.277" do
lambda { [].fill('a', 1) }.should_not raise_error(ArgumentError)
end
lambda { [].fill('a', 1) }.should_not raise_error(ArgumentError)

lambda { [].fill('a', 1, 2) }.should_not raise_error(ArgumentError)
lambda { [].fill('a', 1, 2, true) }.should raise_error(ArgumentError)
Expand All @@ -69,9 +67,7 @@
it "raises an ArgumentError if 3 or more arguments are passed when a block given" do
lambda { [].fill() {|i|} }.should_not raise_error(ArgumentError)

ruby_bug "#", "1.8.6.277" do
lambda { [].fill(1) {|i|} }.should_not raise_error(ArgumentError)
end
lambda { [].fill(1) {|i|} }.should_not raise_error(ArgumentError)

lambda { [].fill(1, 2) {|i|} }.should_not raise_error(ArgumentError)
lambda { [].fill(1, 2, true) {|i|} }.should raise_error(ArgumentError)
Expand Down Expand Up @@ -163,41 +159,35 @@
[1, 2, 3, 4, 5].fill('a', 2, 0).should == [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5].fill('a', -2, 0).should == [1, 2, 3, 4, 5]

ruby_bug "#", "1.8.6.277" do
[1, 2, 3, 4, 5].fill('a', 2, -2).should == [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5].fill('a', -2, -2).should == [1, 2, 3, 4, 5]
end
[1, 2, 3, 4, 5].fill('a', 2, -2).should == [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5].fill('a', -2, -2).should == [1, 2, 3, 4, 5]

[1, 2, 3, 4, 5].fill(2, 0, &@never_passed).should == [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5].fill(-2, 0, &@never_passed).should == [1, 2, 3, 4, 5]

ruby_bug "#", "1.8.6.277" do
[1, 2, 3, 4, 5].fill(2, -2, &@never_passed).should == [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5].fill(-2, -2, &@never_passed).should == [1, 2, 3, 4, 5]
end
[1, 2, 3, 4, 5].fill(2, -2, &@never_passed).should == [1, 2, 3, 4, 5]
[1, 2, 3, 4, 5].fill(-2, -2, &@never_passed).should == [1, 2, 3, 4, 5]
end

ruby_bug "#", "1.8.6.277" do
# See: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/17481
it "does not raise an exception if the given length is negative and its absolute value does not exceed the index" do
lambda { [1, 2, 3, 4].fill('a', 3, -1)}.should_not raise_error(ArgumentError)
lambda { [1, 2, 3, 4].fill('a', 3, -2)}.should_not raise_error(ArgumentError)
lambda { [1, 2, 3, 4].fill('a', 3, -3)}.should_not raise_error(ArgumentError)
# See: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/17481
it "does not raise an exception if the given length is negative and its absolute value does not exceed the index" do
lambda { [1, 2, 3, 4].fill('a', 3, -1)}.should_not raise_error(ArgumentError)
lambda { [1, 2, 3, 4].fill('a', 3, -2)}.should_not raise_error(ArgumentError)
lambda { [1, 2, 3, 4].fill('a', 3, -3)}.should_not raise_error(ArgumentError)

lambda { [1, 2, 3, 4].fill(3, -1, &@never_passed)}.should_not raise_error(ArgumentError)
lambda { [1, 2, 3, 4].fill(3, -2, &@never_passed)}.should_not raise_error(ArgumentError)
lambda { [1, 2, 3, 4].fill(3, -3, &@never_passed)}.should_not raise_error(ArgumentError)
end
lambda { [1, 2, 3, 4].fill(3, -1, &@never_passed)}.should_not raise_error(ArgumentError)
lambda { [1, 2, 3, 4].fill(3, -2, &@never_passed)}.should_not raise_error(ArgumentError)
lambda { [1, 2, 3, 4].fill(3, -3, &@never_passed)}.should_not raise_error(ArgumentError)
end

it "does not raise an exception even if the given length is negative and its absolute value exceeds the index" do
lambda { [1, 2, 3, 4].fill('a', 3, -4)}.should_not raise_error(ArgumentError)
lambda { [1, 2, 3, 4].fill('a', 3, -5)}.should_not raise_error(ArgumentError)
lambda { [1, 2, 3, 4].fill('a', 3, -10000)}.should_not raise_error(ArgumentError)
it "does not raise an exception even if the given length is negative and its absolute value exceeds the index" do
lambda { [1, 2, 3, 4].fill('a', 3, -4)}.should_not raise_error(ArgumentError)
lambda { [1, 2, 3, 4].fill('a', 3, -5)}.should_not raise_error(ArgumentError)
lambda { [1, 2, 3, 4].fill('a', 3, -10000)}.should_not raise_error(ArgumentError)

lambda { [1, 2, 3, 4].fill(3, -4, &@never_passed)}.should_not raise_error(ArgumentError)
lambda { [1, 2, 3, 4].fill(3, -5, &@never_passed)}.should_not raise_error(ArgumentError)
lambda { [1, 2, 3, 4].fill(3, -10000, &@never_passed)}.should_not raise_error(ArgumentError)
end
lambda { [1, 2, 3, 4].fill(3, -4, &@never_passed)}.should_not raise_error(ArgumentError)
lambda { [1, 2, 3, 4].fill(3, -5, &@never_passed)}.should_not raise_error(ArgumentError)
lambda { [1, 2, 3, 4].fill(3, -10000, &@never_passed)}.should_not raise_error(ArgumentError)
end

it "tries to convert the second and third arguments to Integers using #to_int" do
Expand Down

0 comments on commit 05d79cb

Please sign in to comment.