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: c96c52ce4789
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 584b6fbb8582
Choose a head ref
  • 2 commits
  • 29 files changed
  • 1 contributor

Commits on Dec 4, 2014

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    12b6613 View commit details
  2. Updated CI tags.

    brixen committed Dec 4, 2014

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    584b6fb View commit details
33 changes: 33 additions & 0 deletions spec/ruby/command_line/dash_upper_k_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
describe 'The -K command line option sets __ENCODING__' do
it "to Encoding::ASCII_8BIT with -Ka" do
ruby_exe("print __ENCODING__", :options => '-Ka').should == Encoding::ASCII_8BIT.to_s
end

it "to Encoding::ASCII_8BIT with -KA" do
ruby_exe("print __ENCODING__", :options => '-KA').should == Encoding::ASCII_8BIT.to_s
end

it "to Encoding::EUC_JP with -Ke" do
ruby_exe("print __ENCODING__", :options => '-Ke').should == Encoding::EUC_JP.to_s
end

it "to Encoding::EUC_JP with -KE" do
ruby_exe("print __ENCODING__", :options => '-KE').should == Encoding::EUC_JP.to_s
end

it "to Encoding::UTF_8 with -Ku" do
ruby_exe("print __ENCODING__", :options => '-Ku').should == Encoding::UTF_8.to_s
end

it "to Encoding::UTF_8 with -KU" do
ruby_exe("print __ENCODING__", :options => '-KU').should == Encoding::UTF_8.to_s
end

it "to Encoding::Windows_31J with -Ks" do
ruby_exe("print __ENCODING__", :options => '-Ks').should == Encoding::Windows_31J.to_s
end

it "to Encoding::Windows_31J with -KS" do
ruby_exe("print __ENCODING__", :options => '-KS').should == Encoding::Windows_31J.to_s
end
end
162 changes: 162 additions & 0 deletions spec/ruby/command_line/rubyopt_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
require File.expand_path('../../spec_helper', __FILE__)

describe "Processing RUBYOPT" do
before (:each) do
@rubyopt, ENV["RUBYOPT"] = ENV["RUBYOPT"], nil
@ruby_flags, ENV["RUBY_FLAGS"] = ENV["RUBY_FLAGS"], nil
end

after (:each) do
ENV["RUBYOPT"] = @rubyopt
ENV["RUBY_FLAGS"] = @ruby_flags
end

it "adds the -I path to $LOAD_PATH" do
ENV["RUBYOPT"] = "-Ioptrubyspecincl"
result = ruby_exe("puts $LOAD_PATH.grep(/byspecin/)", :escape => true)
result.chomp[-15..-1].should == "optrubyspecincl"
end

it "sets $DEBUG to true for '-d'" do
ENV["RUBYOPT"] = '-d'
command = %[puts "value of $DEBUG is \#{$DEBUG}"]
result = ruby_exe(command, :escape => true, :args => "2>&1")
result.should =~ /value of \$DEBUG is true/
end

it "prints the version number for '-v'" do
ENV["RUBYOPT"] = '-v'
ruby_exe("").chomp.should == RUBY_DESCRIPTION
end

it "sets $VERBOSE to true for '-w'" do
ENV["RUBYOPT"] = '-w'
ruby_exe("p $VERBOSE", :escape => true).chomp.should == "true"
end

it "sets $VERBOSE to true for '-W'" do
ENV["RUBYOPT"] = '-W'
ruby_exe("p $VERBOSE", :escape => true).chomp.should == "true"
end

it "sets $VERBOSE to nil for '-W0'" do
ENV["RUBYOPT"] = '-W0'
ruby_exe("p $VERBOSE", :escape => true).chomp.should == "nil"
end

it "sets $VERBOSE to false for '-W1'" do
ENV["RUBYOPT"] = '-W1'
ruby_exe("p $VERBOSE", :escape => true).chomp.should == "false"
end

it "sets $VERBOSE to true for '-W2'" do
ENV["RUBYOPT"] = '-W2'
ruby_exe("p $VERBOSE", :escape => true).chomp.should == "true"
end

it "requires the file for '-r'" do
f = fixture __FILE__, "rubyopt"
ENV["RUBYOPT"] = "-r#{f}"
ruby_exe("").should =~ /^rubyopt.rb required/
end

it "raises a RuntimeError for '-a'" do
ENV["RUBYOPT"] = '-a'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '-p'" do
ENV["RUBYOPT"] = '-p'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '-n'" do
ENV["RUBYOPT"] = '-n'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '-y'" do
ENV["RUBYOPT"] = '-y'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '-c'" do
ENV["RUBYOPT"] = '-c'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '-s'" do
ENV["RUBYOPT"] = '-s'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '-h'" do
ENV["RUBYOPT"] = '-h'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '--help'" do
ENV["RUBYOPT"] = '--help'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '-l'" do
ENV["RUBYOPT"] = '-l'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '-S'" do
ENV["RUBYOPT"] = '-S irb'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '-e'" do
ENV["RUBYOPT"] = '-e0'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '-i'" do
ENV["RUBYOPT"] = '-i.bak'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '-x'" do
ENV["RUBYOPT"] = '-x'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '-C'" do
ENV["RUBYOPT"] = '-C'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '-X'" do
ENV["RUBYOPT"] = '-X.'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '-F'" do
ENV["RUBYOPT"] = '-F'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '-0'" do
ENV["RUBYOPT"] = '-0'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '--copyright'" do
ENV["RUBYOPT"] = '--copyright'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '--version'" do
ENV["RUBYOPT"] = '--version'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end

it "raises a RuntimeError for '--yydebug'" do
ENV["RUBYOPT"] = '--yydebug'
ruby_exe("", :args => '2>&1').should =~ /RuntimeError/
end
end
13 changes: 13 additions & 0 deletions spec/ruby/core/dir/glob_spec.rb
Original file line number Diff line number Diff line change
@@ -118,6 +118,19 @@
Dir.glob('./**/', File::FNM_DOTMATCH).sort.should == expected
end

it "matches a list of paths by concatenating their individual results" do
expected = %w[
deeply/
deeply/nested/
deeply/nested/directory/
deeply/nested/directory/structure/
subdir_two/nondotfile
subdir_two/nondotfile.ext
]

Dir.glob('{deeply/**/,subdir_two/*}').sort.should == expected
end

it "accepts a block and yields it with each elements" do
ary = []
ret = Dir.glob(["file_o*", "file_t*"]) { |t| ary << t }
10 changes: 10 additions & 0 deletions spec/ruby/core/exception/message_spec.rb
Original file line number Diff line number Diff line change
@@ -14,4 +14,14 @@
exc = ExceptionSpecs::OverrideToS.new("you won't see this")
exc.message.should == "this is from #to_s"
end

context "when #backtrace is redefined" do
it "returns the Exception message" do
e = Exception.new
e.message.should == 'Exception'

def e.backtrace; []; end
e.message.should == 'Exception'
end
end
end
11 changes: 0 additions & 11 deletions spec/ruby/core/exception/redefining_backtrace.rb

This file was deleted.

5 changes: 5 additions & 0 deletions spec/ruby/core/float/divide_spec.rb
Original file line number Diff line number Diff line change
@@ -28,4 +28,9 @@
(0.0 / -0.0).should be_nan
(-0.0 / -0.0).should be_nan
end

it "raises a TypeError when given a non-Numeric" do
lambda { 13.0 / "10" }.should raise_error(TypeError)
lambda { 13.0 / :symbol }.should raise_error(TypeError)
end
end
5 changes: 5 additions & 0 deletions spec/ruby/core/float/gt_spec.rb
Original file line number Diff line number Diff line change
@@ -6,4 +6,9 @@
(2.5 > 3).should == false
(45.91 > bignum_value).should == false
end

it "raises an ArgumentError when given a non-Numeric" do
lambda { 5.0 > "4" }.should raise_error(ArgumentError)
lambda { 5.0 > mock('x') }.should raise_error(ArgumentError)
end
end
5 changes: 5 additions & 0 deletions spec/ruby/core/float/gte_spec.rb
Original file line number Diff line number Diff line change
@@ -6,4 +6,9 @@
(9.71 >= 1).should == true
(5.55382 >= 0xfabdafbafcab).should == false
end

it "raises an ArgumentError when given a non-Numeric" do
lambda { 5.0 >= "4" }.should raise_error(ArgumentError)
lambda { 5.0 >= mock('x') }.should raise_error(ArgumentError)
end
end
5 changes: 5 additions & 0 deletions spec/ruby/core/float/lt_spec.rb
Original file line number Diff line number Diff line change
@@ -6,4 +6,9 @@
(192.6 < -500).should == false
(-0.12 < 0x4fffffff).should == true
end

it "raises an ArgumentError when given a non-Numeric" do
lambda { 5.0 < "4" }.should raise_error(ArgumentError)
lambda { 5.0 < mock('x') }.should raise_error(ArgumentError)
end
end
5 changes: 5 additions & 0 deletions spec/ruby/core/float/lte_spec.rb
Original file line number Diff line number Diff line change
@@ -7,4 +7,9 @@
(0.0 <= 0.0).should == true
(9_235.9 <= bignum_value).should == true
end

it "raises an ArgumentError when given a non-Numeric" do
lambda { 5.0 <= "4" }.should raise_error(ArgumentError)
lambda { 5.0 <= mock('x') }.should raise_error(ArgumentError)
end
end
5 changes: 5 additions & 0 deletions spec/ruby/core/float/multiply_spec.rb
Original file line number Diff line number Diff line change
@@ -6,4 +6,9 @@
(6712.5 * 0.25).should be_close(1678.125, TOLERANCE)
(256.4096 * bignum_value).should be_close(2364961134621118431232.000, TOLERANCE)
end

it "raises a TypeError when given a non-Numeric" do
lambda { 13.0 * "10" }.should raise_error(TypeError)
lambda { 13.0 * :symbol }.should raise_error(TypeError)
end
end
11 changes: 11 additions & 0 deletions spec/ruby/core/kernel/instance_eval_spec.rb
Original file line number Diff line number Diff line change
@@ -34,6 +34,17 @@ def foo
lambda { Object.new.foo }.should raise_error(NoMethodError)
end

it "preserves self in the original block when passed a block argument" do
prc = proc { self }

old_self = prc.call

new_self = Object.new
new_self.instance_eval(&prc).should == new_self

prc.call.should == old_self
end

# TODO: This should probably be replaced with a "should behave like" that uses
# the many scoping/binding specs from kernel/eval_spec, since most of those
# behaviors are the same for instance_eval. See also module_eval/class_eval.
1 change: 0 additions & 1 deletion spec/ruby/core/symbol/encoding_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path("../versions/encoding_1.9", __FILE__)

describe "Symbol#encoding for ASCII symbols" do
it "is US-ASCII" do
4 changes: 0 additions & 4 deletions spec/ruby/language/def_spec.rb
Original file line number Diff line number Diff line change
@@ -572,7 +572,3 @@ def some_method; end
end
end
end

ruby_version_is "2.0" do
require File.expand_path('../versions/def_2.0.rb', __FILE__)
end
32 changes: 0 additions & 32 deletions spec/ruby/language/encoding_spec.rb
Original file line number Diff line number Diff line change
@@ -30,38 +30,6 @@
CodingUTF_8.encoding.should == Encoding::UTF_8
end

it "is Encoding::ASCII_8BIT when the interpreter is invoked with -Ka" do
ruby_exe("print __ENCODING__", :options => '-Ka').should == Encoding::ASCII_8BIT.to_s
end

it "is Encoding::ASCII_8BIT when the interpreter is invoked with -KA" do
ruby_exe("print __ENCODING__", :options => '-KA').should == Encoding::ASCII_8BIT.to_s
end

it "is Encoding::EUC_JP when the interpreter is invoked with -Ke" do
ruby_exe("print __ENCODING__", :options => '-Ke').should == Encoding::EUC_JP.to_s
end

it "is Encoding::EUC_JP when the interpreter is invoked with -KE" do
ruby_exe("print __ENCODING__", :options => '-KE').should == Encoding::EUC_JP.to_s
end

it "is Encoding::UTF_8 when the interpreter is invoked with -Ku" do
ruby_exe("print __ENCODING__", :options => '-Ku').should == Encoding::UTF_8.to_s
end

it "is Encoding::UTF_8 when the interpreter is invoked with -KU" do
ruby_exe("print __ENCODING__", :options => '-KU').should == Encoding::UTF_8.to_s
end

it "is Encoding::Windows_31J when the interpreter is invoked with -Ks" do
ruby_exe("print __ENCODING__", :options => '-Ks').should == Encoding::Windows_31J.to_s
end

it "is Encoding::Windows_31J when the interpreter is invoked with -KS" do
ruby_exe("print __ENCODING__", :options => '-KS').should == Encoding::Windows_31J.to_s
end

it "raises a SyntaxError if assigned to" do
lambda { eval("__ENCODING__ = 1") }.should raise_error(SyntaxError)
end
Loading