[macruby-changes] [1696] MacRuby/branches/experimental/spec/frozen
source_changes at macosforge.org
source_changes at macosforge.org
Mon Jun 1 16:10:32 PDT 2009
Revision: 1696
http://trac.macosforge.org/projects/ruby/changeset/1696
Author: eloy.de.enige at gmail.com
Date: 2009-06-01 16:10:32 -0700 (Mon, 01 Jun 2009)
Log Message:
-----------
Updated RubySpec to 34f2569f0b4fcf2a61b0ea5923fb42de26484642
Modified Paths:
--------------
MacRuby/branches/experimental/spec/frozen/core/enumerable/shared/take.rb
MacRuby/branches/experimental/spec/frozen/core/string/center_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/chomp_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/shared/concat.rb
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/enumerable/first_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/enumerable/take_tags.txt
MacRuby/branches/experimental/spec/frozen/upstream
Removed Paths:
-------------
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/append_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/capitalize_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/center_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/chomp_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/concat_tags.txt
Modified: MacRuby/branches/experimental/spec/frozen/core/enumerable/shared/take.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/enumerable/shared/take.rb 2009-06-01 23:02:05 UTC (rev 1695)
+++ MacRuby/branches/experimental/spec/frozen/core/enumerable/shared/take.rb 2009-06-01 23:10:32 UTC (rev 1696)
@@ -4,47 +4,55 @@
@enum = EnumerableSpecs::Numerous.new(*@values)
end
- ruby_version_is '1.8.7' do
- it "returns the first count elements if given a count" do
- @enum.send(@method, 2).should == [4, 3]
- end
+ it "returns the first count elements if given a count" do
+ @enum.send(@method, 2).should == [4, 3]
+ end
- it "returns an empty array when passed count on an empty array" do
- empty = EnumerableSpecs::Empty.new
- empty.send(@method, 0).should == []
- empty.send(@method, 1).should == []
- empty.send(@method, 2).should == []
- end
+ it "returns an empty array when passed count on an empty array" do
+ empty = EnumerableSpecs::Empty.new
+ empty.send(@method, 0).should == []
+ empty.send(@method, 1).should == []
+ empty.send(@method, 2).should == []
+ end
- it "returns an empty array when passed count == 0" do
- @enum.send(@method, 0).should == []
- end
+ it "returns an empty array when passed count == 0" do
+ @enum.send(@method, 0).should == []
+ end
- it "returns an array containing the first element when passed count == 1" do
- @enum.send(@method, 1).should == [4]
- end
+ it "returns an array containing the first element when passed count == 1" do
+ @enum.send(@method, 1).should == [4]
+ end
- it "raises an ArgumentError when count is negative" do
- lambda { @enum.send(@method, -1) }.should raise_error(ArgumentError)
- end
+ it "raises an ArgumentError when count is negative" do
+ lambda { @enum.send(@method, -1) }.should raise_error(ArgumentError)
+ end
- it "returns the entire array when count > length" do
- @enum.send(@method, 10).should == @values
- end
+ it "returns the entire array when count > length" do
+ @enum.send(@method, 10).should == @values
+ end
- it "tries to convert the passed argument to an Integer using #to_int" do
- obj = mock('to_int')
- obj.should_receive(:to_int).and_return(3).at_most(:twice) # called twice, no apparent reason. should we care?
- @enum.send(@method, obj).should == [4, 3, 2]
- end
+ it "tries to convert the passed argument to an Integer using #to_int" do
+ obj = mock('to_int')
+ obj.should_receive(:to_int).and_return(3).at_most(:twice) # called twice, no apparent reason. See redmine #1554
+ @enum.send(@method, obj).should == [4, 3, 2]
+ end
- it "raises a TypeError if the passed argument is not numeric" do
- lambda { @enum.send(@method, nil) }.should raise_error(TypeError)
- lambda { @enum.send(@method, "a") }.should raise_error(TypeError)
+ it "raises a TypeError if the passed argument is not numeric" do
+ lambda { @enum.send(@method, nil) }.should raise_error(TypeError)
+ lambda { @enum.send(@method, "a") }.should raise_error(TypeError)
- obj = mock("nonnumeric")
- lambda { @enum.send(@method, obj) }.should raise_error(TypeError)
+ obj = mock("nonnumeric")
+ lambda { @enum.send(@method, obj) }.should raise_error(TypeError)
+ end
+
+ ruby_bug "#1554", "1.9.1" do
+ it "consumes only what is needed" do
+ thrower = EnumerableSpecs::ThrowingEach.new
+ thrower.send(@method, 0).should == []
+ counter = EnumerableSpecs::EachCounter.new(1,2,3,4)
+ counter.send(@method, 2).should == [1,2]
+ counter.times_called.should == 1
+ counter.times_yielded.should == 2
end
-
end
end
\ No newline at end of file
Modified: MacRuby/branches/experimental/spec/frozen/core/string/center_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/center_spec.rb 2009-06-01 23:02:05 UTC (rev 1695)
+++ MacRuby/branches/experimental/spec/frozen/core/string/center_spec.rb 2009-06-01 23:10:32 UTC (rev 1696)
@@ -79,7 +79,7 @@
it "raises a TypeError when padstr can't be converted to a string" do
lambda { "hello".center(20, 100) }.should raise_error(TypeError)
- lambda { "hello".center(20, :llo) }.should raise_error(TypeError)
+ lambda { "hello".center(20, []) }.should raise_error(TypeError)
lambda { "hello".center(20, mock('x')) }.should raise_error(TypeError)
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/chomp_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/chomp_spec.rb 2009-06-01 23:02:05 UTC (rev 1695)
+++ MacRuby/branches/experimental/spec/frozen/core/string/chomp_spec.rb 2009-06-01 23:10:32 UTC (rev 1696)
@@ -78,8 +78,8 @@
end
it "raises a TypeError if separator can't be converted to a string" do
- lambda { "hello".chomp(?o) }.should raise_error(TypeError)
- lambda { "hello".chomp(:llo) }.should raise_error(TypeError)
+ lambda { "hello".chomp(30.3) }.should raise_error(TypeError)
+ lambda { "hello".chomp([]) }.should raise_error(TypeError)
lambda { "hello".chomp(mock('x')) }.should raise_error(TypeError)
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/shared/concat.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/shared/concat.rb 2009-06-01 23:02:05 UTC (rev 1695)
+++ MacRuby/branches/experimental/spec/frozen/core/string/shared/concat.rb 2009-06-01 23:10:32 UTC (rev 1696)
@@ -13,7 +13,7 @@
end
it "raises a TypeError if the given argument can't be converted to a String" do
- lambda { a = 'hello '.send(@method, :world) }.should raise_error(TypeError)
+ lambda { a = 'hello '.send(@method, []) }.should raise_error(TypeError)
lambda { a = 'hello '.send(@method, mock('x')) }.should raise_error(TypeError)
end
@@ -36,6 +36,14 @@
end
end
+ ruby_version_is "1.9" do
+ it "raises ArgumentError for negative length argument" do
+ lambda do
+ 'glark'.force_encoding('UTF-8').send(@method, -200)
+ end.should raise_error(ArgumentError)
+ end
+ end
+
it "works when given a subclass instance" do
a = "hello"
a << StringSpecs::MyString.new(" world")
@@ -59,10 +67,12 @@
b.should == "hello world!\x00"
end
- it "raises a TypeError when the given Fixnum is not between 0 and 255" do
- lambda { "hello world".send(@method, 333) }.should raise_error(TypeError)
- lambda { "".send(@method, (256 * 3 + 64)) }.should raise_error(TypeError)
- lambda { "".send(@method, -200) }.should raise_error(TypeError)
+ ruby_version_is ""..."1.9" do
+ it "raises a TypeError when the given Fixnum is not between 0 and 255" do
+ lambda { "hello world" << 333 }.should raise_error(TypeError)
+ lambda { "".send(@method, (256 * 3 + 64)) }.should raise_error(TypeError)
+ lambda { "".send(@method, -200) }.should raise_error(TypeError)
+ end
end
it "doesn't call to_int on its argument" do
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/append_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/append_tags.txt 2009-06-01 23:02:05 UTC (rev 1695)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/append_tags.txt 2009-06-01 23:10:32 UTC (rev 1696)
@@ -1,4 +0,0 @@
-fails:String#<< raises a TypeError when self is frozen
-fails:String#<< with Fixnum raises a TypeError when the given Fixnum is not between 0 and 255
-fails:String#<< with Fixnum raises a TypeError when self is frozen
-fails:String#<< raises a TypeError if the given argument can't be converted to a String
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/capitalize_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/capitalize_tags.txt 2009-06-01 23:02:05 UTC (rev 1695)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/capitalize_tags.txt 2009-06-01 23:10:32 UTC (rev 1696)
@@ -1 +0,0 @@
-fails:String#capitalize! raises a TypeError when self is frozen
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/center_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/center_tags.txt 2009-06-01 23:02:05 UTC (rev 1695)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/center_tags.txt 2009-06-01 23:10:32 UTC (rev 1696)
@@ -1 +0,0 @@
-fails:String#center with length, padding raises a TypeError when padstr can't be converted to a string
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/chomp_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/chomp_tags.txt 2009-06-01 23:02:05 UTC (rev 1695)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/chomp_tags.txt 2009-06-01 23:10:32 UTC (rev 1696)
@@ -1,2 +0,0 @@
-fails:String#chomp with separator raises a TypeError if separator can't be converted to a string
-fails:String#chomp! with separator raises a TypeError when self is frozen
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/concat_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/concat_tags.txt 2009-06-01 23:02:05 UTC (rev 1695)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/concat_tags.txt 2009-06-01 23:10:32 UTC (rev 1696)
@@ -1,4 +0,0 @@
-fails:String#concat raises a TypeError when self is frozen
-fails:String#concat with Fixnum raises a TypeError when the given Fixnum is not between 0 and 255
-fails:String#concat with Fixnum raises a TypeError when self is frozen
-fails:String#concat raises a TypeError if the given argument can't be converted to a String
Modified: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/enumerable/first_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/enumerable/first_tags.txt 2009-06-01 23:02:05 UTC (rev 1695)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/enumerable/first_tags.txt 2009-06-01 23:10:32 UTC (rev 1696)
@@ -2,3 +2,4 @@
fails:Enumerable#first when passed an argument returns an empty array when passed count == 0
fails:Enumerable#first when passed an argument returns an array containing the first element when passed count == 1
fails:Enumerable#first when passed an argument tries to convert the passed argument to an Integer using #to_int
+fails:Enumerable#first when passed an argument consumes only what is needed
Modified: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/enumerable/take_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/enumerable/take_tags.txt 2009-06-01 23:02:05 UTC (rev 1695)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/enumerable/take_tags.txt 2009-06-01 23:10:32 UTC (rev 1696)
@@ -3,3 +3,4 @@
fails:Enumerable#take when passed an argument returns an empty array when passed count == 0
fails:Enumerable#take when passed an argument returns an array containing the first element when passed count == 1
fails:Enumerable#take when passed an argument tries to convert the passed argument to an Integer using #to_int
+fails:Enumerable#take when passed an argument consumes only what is needed
\ No newline at end of file
Modified: MacRuby/branches/experimental/spec/frozen/upstream
===================================================================
--- MacRuby/branches/experimental/spec/frozen/upstream 2009-06-01 23:02:05 UTC (rev 1695)
+++ MacRuby/branches/experimental/spec/frozen/upstream 2009-06-01 23:10:32 UTC (rev 1696)
@@ -1 +1 @@
-2f319ffb5dbeed2f79c7a4a4747f749fe7e48426
\ No newline at end of file
+34f2569f0b4fcf2a61b0ea5923fb42de26484642
\ No newline at end of file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090601/3491c01d/attachment-0001.html>
More information about the macruby-changes
mailing list