mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@83063a3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1e658d45e1
commit
3fa5bd38af
494 changed files with 4133 additions and 3109 deletions
|
@ -1,5 +1,5 @@
|
|||
require File.expand_path('../shared/abs', __FILE__)
|
||||
|
||||
describe "Numeric#abs" do
|
||||
it_behaves_like(:numeric_abs, :abs)
|
||||
it_behaves_like :numeric_abs, :abs
|
||||
end
|
||||
|
|
|
@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
|
|||
require File.expand_path('../../../shared/complex/numeric/arg', __FILE__)
|
||||
|
||||
describe "Numeric#angle" do
|
||||
it_behaves_like(:numeric_arg, :angle)
|
||||
it_behaves_like :numeric_arg, :angle
|
||||
end
|
||||
|
|
|
@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
|
|||
require File.expand_path('../../../shared/complex/numeric/arg', __FILE__)
|
||||
|
||||
describe "Numeric#arg" do
|
||||
it_behaves_like(:numeric_arg, :arg)
|
||||
it_behaves_like :numeric_arg, :arg
|
||||
end
|
||||
|
|
|
@ -29,33 +29,16 @@ describe "Numeric#coerce" do
|
|||
end
|
||||
end
|
||||
|
||||
it "calls #to_f to convert other if self responds to #to_f" do
|
||||
# Do not use NumericSpecs::Subclass here, because coerce checks the classes of the receiver
|
||||
# and arguments before calling #to_f.
|
||||
other = mock("numeric")
|
||||
lambda { @obj.coerce(other) }.should raise_error(TypeError)
|
||||
it "returns [other.to_f, self.to_f] if self and other are instances of different classes" do
|
||||
@obj.coerce(2.5).should == [2.5, 10.5]
|
||||
@obj.coerce(3).should == [3.0, 10.5]
|
||||
@obj.coerce("4.4").should == [4.4, 10.5]
|
||||
@obj.coerce(bignum_value).should == [bignum_value.to_f, 10.5]
|
||||
end
|
||||
|
||||
it "returns [other.to_f, self.to_f] if self and other are instances of different classes" do
|
||||
result = @obj.coerce(2.5)
|
||||
result.should == [2.5, 10.5]
|
||||
result.first.should be_kind_of(Float)
|
||||
result.last.should be_kind_of(Float)
|
||||
|
||||
result = @obj.coerce(3)
|
||||
result.should == [3.0, 10.5]
|
||||
result.first.should be_kind_of(Float)
|
||||
result.last.should be_kind_of(Float)
|
||||
|
||||
result = @obj.coerce("4.4")
|
||||
result.should == [4.4, 10.5]
|
||||
result.first.should be_kind_of(Float)
|
||||
result.last.should be_kind_of(Float)
|
||||
|
||||
result = @obj.coerce(bignum_value)
|
||||
result.should == [bignum_value.to_f, 10.5]
|
||||
result.first.should be_kind_of(Float)
|
||||
result.last.should be_kind_of(Float)
|
||||
it "raise TypeError if they are instances of different classes and other does not respond to #to_f" do
|
||||
other = mock("numeric")
|
||||
lambda { @obj.coerce(other) }.should raise_error(TypeError)
|
||||
end
|
||||
|
||||
it "raises a TypeError when passed nil" do
|
||||
|
@ -70,7 +53,7 @@ describe "Numeric#coerce" do
|
|||
lambda { @obj.coerce(:symbol) }.should raise_error(TypeError)
|
||||
end
|
||||
|
||||
it "raises an ArgumentError when passed a String" do
|
||||
it "raises an ArgumentError when passed a non-numeric String" do
|
||||
lambda { @obj.coerce("test") }.should raise_error(ArgumentError)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
|
|||
require File.expand_path('../../../shared/complex/numeric/conj', __FILE__)
|
||||
|
||||
describe "Numeric#conj" do
|
||||
it_behaves_like(:numeric_conj, :conj)
|
||||
it_behaves_like :numeric_conj, :conj
|
||||
end
|
||||
|
|
|
@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
|
|||
require File.expand_path('../../../shared/complex/numeric/conj', __FILE__)
|
||||
|
||||
describe "Numeric#conjugate" do
|
||||
it_behaves_like(:numeric_conj, :conjugate)
|
||||
it_behaves_like :numeric_conj, :conjugate
|
||||
end
|
||||
|
|
|
@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
|
|||
require File.expand_path('../../../shared/complex/numeric/imag', __FILE__)
|
||||
|
||||
describe "Numeric#imag" do
|
||||
it_behaves_like(:numeric_imag, :imag)
|
||||
it_behaves_like :numeric_imag, :imag
|
||||
end
|
||||
|
|
|
@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
|
|||
require File.expand_path('../../../shared/complex/numeric/imag', __FILE__)
|
||||
|
||||
describe "Numeric#imaginary" do
|
||||
it_behaves_like(:numeric_imag, :imaginary)
|
||||
it_behaves_like :numeric_imag, :imaginary
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require File.expand_path('../shared/abs', __FILE__)
|
||||
|
||||
describe "Numeric#magnitude" do
|
||||
it_behaves_like(:numeric_abs, :magnitude)
|
||||
it_behaves_like :numeric_abs, :magnitude
|
||||
end
|
||||
|
|
|
@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
|
|||
require File.expand_path('../../../shared/complex/numeric/arg', __FILE__)
|
||||
|
||||
describe "Numeric#phase" do
|
||||
it_behaves_like(:numeric_arg, :phase)
|
||||
it_behaves_like :numeric_arg, :phase
|
||||
end
|
||||
|
|
|
@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
|
|||
require File.expand_path('../../../shared/complex/numeric/polar', __FILE__)
|
||||
|
||||
describe "Numeric#polar" do
|
||||
it_behaves_like(:numeric_polar, :polar)
|
||||
it_behaves_like :numeric_polar, :polar
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ require File.expand_path('../../../shared/complex/numeric/real', __FILE__)
|
|||
require File.expand_path('../fixtures/classes', __FILE__)
|
||||
|
||||
describe "Numeric#real" do
|
||||
it_behaves_like(:numeric_real, :real)
|
||||
it_behaves_like :numeric_real, :real
|
||||
end
|
||||
|
||||
describe "Numeric#real?" do
|
||||
|
|
|
@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
|
|||
require File.expand_path('../shared/rect', __FILE__)
|
||||
|
||||
describe "Numeric#rect" do
|
||||
it_behaves_like(:numeric_rect, :rect)
|
||||
it_behaves_like :numeric_rect, :rect
|
||||
end
|
||||
|
|
|
@ -2,5 +2,5 @@ require File.expand_path('../../../spec_helper', __FILE__)
|
|||
require File.expand_path('../shared/rect', __FILE__)
|
||||
|
||||
describe "Numeric#rectangular" do
|
||||
it_behaves_like(:numeric_rect, :rectangular)
|
||||
it_behaves_like :numeric_rect, :rectangular
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue