[macruby-changes] [1748] MacRuby/branches/experimental/spec/frozen
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jun 5 08:47:48 PDT 2009
Revision: 1748
http://trac.macosforge.org/projects/ruby/changeset/1748
Author: eloy.de.enige at gmail.com
Date: 2009-06-05 08:47:47 -0700 (Fri, 05 Jun 2009)
Log Message:
-----------
Updated RubySpec to 9153e76040d7393521a4980f8b285ecb11e0df91
Modified Paths:
--------------
MacRuby/branches/experimental/spec/frozen/core/hash/constructor_spec.rb
MacRuby/branches/experimental/spec/frozen/core/hash/eql_spec.rb
MacRuby/branches/experimental/spec/frozen/core/hash/equal_value_spec.rb
MacRuby/branches/experimental/spec/frozen/core/hash/indexes_spec.rb
MacRuby/branches/experimental/spec/frozen/core/hash/indices_spec.rb
MacRuby/branches/experimental/spec/frozen/core/hash/shared/eql.rb
MacRuby/branches/experimental/spec/frozen/core/hash/shared/to_s.rb
MacRuby/branches/experimental/spec/frozen/core/hash/to_a_spec.rb
MacRuby/branches/experimental/spec/frozen/core/io/foreach_spec.rb
MacRuby/branches/experimental/spec/frozen/core/io/putc_spec.rb
MacRuby/branches/experimental/spec/frozen/core/io/puts_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/io/readchar_spec.rb
MacRuby/branches/experimental/spec/frozen/core/io/readlines_spec.rb
MacRuby/branches/experimental/spec/frozen/core/io/shared/each.rb
MacRuby/branches/experimental/spec/frozen/core/io/shared/new.rb
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/io/foreach_tags.txt
MacRuby/branches/experimental/spec/frozen/upstream
Added Paths:
-----------
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/kernel/__callee__tags.txt
Removed Paths:
-------------
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/clear_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/default_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/delete_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/each_key_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/each_pair_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/each_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/each_value_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/element_set_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/indexes_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/indices_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/initialize_copy_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/initialize_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/merge_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/rehash_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/replace_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/select_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/shift_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/store_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/to_a_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/to_s_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/update_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/kernel/__callee___tags.txt
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/constructor_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/constructor_spec.rb 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/constructor_spec.rb 2009-06-05 15:47:47 UTC (rev 1748)
@@ -17,12 +17,14 @@
ruby_version_is '1.8.7' do
# Not officially documented yet, see http://redmine.ruby-lang.org/issues/show/1385
- it "creates a Hash; values can be provided as a list of value-pairs in an array" do
- hash_class[[[:a, 1], [:b, 2]]].should == new_hash(:a => 1, :b => 2)
- hash_class[[[:a, 1], [:b], 42, [:d, 2], [:e, 2, 3], []]].should == new_hash(:a => 1, :b => nil, :d => 2)
- obj = mock('x')
- def obj.to_ary() [:b, 2] end
- hash_class[[[:a, 1], obj]].should == new_hash(:a => 1, :b => 2)
+ ruby_bug "[ruby-core:21249]", "1.8.7.167" do
+ it "creates a Hash; values can be provided as a list of value-pairs in an array" do
+ hash_class[[[:a, 1], [:b, 2]]].should == new_hash(:a => 1, :b => 2)
+ hash_class[[[:a, 1], [:b], 42, [:d, 2], [:e, 2, 3], []]].should == new_hash(:a => 1, :b => nil, :d => 2)
+ obj = mock('x')
+ def obj.to_ary() [:b, 2] end
+ hash_class[[[:a, 1], obj]].should == new_hash(:a => 1, :b => 2)
+ end
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/eql_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/eql_spec.rb 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/eql_spec.rb 2009-06-05 15:47:47 UTC (rev 1748)
@@ -7,7 +7,12 @@
describe "Hash#eql?" do
it_behaves_like :hash_eql, :eql?
+
ruby_version_is '1.8.7' do
it_behaves_like :hash_eql_additional, :eql?
- end
+ end
+
+ ruby_version_is '1.9' do
+ it_behaves_like :hash_eql_additional_more, :eql?
+ end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/equal_value_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/equal_value_spec.rb 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/equal_value_spec.rb 2009-06-05 15:47:47 UTC (rev 1748)
@@ -5,8 +5,9 @@
describe "Hash#==" do
it_behaves_like :hash_eql, :==
it_behaves_like :hash_eql_additional, :==
-
+ it_behaves_like :hash_eql_additional_more, :==
+
it "compares values with == semantics" do
new_hash("x" => 1.0).should == new_hash("x" => 1)
end
-end
\ No newline at end of file
+end
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/indexes_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/indexes_spec.rb 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/indexes_spec.rb 2009-06-05 15:47:47 UTC (rev 1748)
@@ -2,6 +2,8 @@
require File.dirname(__FILE__) + '/fixtures/classes'
require File.dirname(__FILE__) + '/values_at_spec'
-describe "Hash#indexes" do
- it_behaves_like(:hash_values_at, :indexes)
+ruby_version_is ""..."1.9" do
+ describe "Hash#indexes" do
+ it_behaves_like(:hash_values_at, :indexes)
+ end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/indices_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/indices_spec.rb 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/indices_spec.rb 2009-06-05 15:47:47 UTC (rev 1748)
@@ -2,6 +2,8 @@
require File.dirname(__FILE__) + '/fixtures/classes'
require File.dirname(__FILE__) + '/values_at_spec'
-describe "Hash#indices" do
- it_behaves_like(:hash_values_at, :indices)
+ruby_version_is ""..."1.9" do
+ describe "Hash#indices" do
+ it_behaves_like(:hash_values_at, :indices)
+ end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/shared/eql.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/shared/eql.rb 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/shared/eql.rb 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1,10 +1,9 @@
describe :hash_eql, :shared => true do
-
it "does not compare values when keys don't match" do
value = mock('x')
value.should_not_receive(:==)
value.should_not_receive(:eql?)
- new_hash(1 => value).send(@method, new_hash(2 => value)).should == false
+ new_hash(1 => value).send(@method, new_hash(2 => value)).should be_false
end
it "returns false when the numbers of keys differ without comparing any elements" do
@@ -14,8 +13,8 @@
obj.should_not_receive(:==)
obj.should_not_receive(:eql?)
- new_hash.send(@method, h).should == false
- h.send(@method, new_hash).should == false
+ new_hash.send(@method, h).should be_false
+ h.send(@method, new_hash).should be_false
end
it "first compares keys via hash" do
@@ -25,7 +24,7 @@
y = mock('y')
def y.hash() 0 end
- new_hash(x => 1).send(@method, new_hash(y => 1)).should == false
+ new_hash(x => 1).send(@method, new_hash(y => 1)).should be_false
end
it "does not compare keys with different hash codes via eql?" do
@@ -46,61 +45,61 @@
def x.hash() 0 end
def y.hash() 1 end
- new_hash(x => 1).send(@method, new_hash(y => 1)).should == false
+ new_hash(x => 1).send(@method, new_hash(y => 1)).should be_false
end
it "computes equality for recursive hashes" do
h = new_hash
h[:a] = h
- h.send(@method, h[:a]).should == true
- (h == h[:a]).should == true
+ h.send(@method, h[:a]).should be_true
+ (h == h[:a]).should be_true
end
-
+
it "doesn't call to_hash on objects" do
mock_hash = mock("fake hash")
def mock_hash.to_hash() new_hash end
new_hash.send(@method, mock_hash).should be_false
end
-
+
ruby_bug "redmine #2448", "1.9.1" do
it "computes equality for complex recursive hashes" do
a, b = {}, {}
a.merge! :self => a, :other => b
b.merge! :self => b, :other => a
- a.send(@method, b).should == true # they both have the same structure!
+ a.send(@method, b).should be_true # they both have the same structure!
c = {}
c.merge! :other => c, :self => c
- c.send(@method, a).should == true # subtle, but they both have the same structure!
+ c.send(@method, a).should be_true # subtle, but they both have the same structure!
a[:delta] = c[:delta] = a
- c.send(@method, a).should == false # not quite the same structure, as a[:other][:delta] = nil
+ c.send(@method, a).should be_false # not quite the same structure, as a[:other][:delta] = nil
c[:delta] = 42
- c.send(@method, a).should == false
+ c.send(@method, a).should be_false
a[:delta] = 42
- c.send(@method, a).should == false
+ c.send(@method, a).should be_false
b[:delta] = 42
- c.send(@method, a).should == true
+ c.send(@method, a).should be_true
end
-
+
it "computes equality for recursive hashes & arrays" do
x, y, z = [], [], []
a, b, c = {:foo => x, :bar => 42}, {:foo => y, :bar => 42}, {:foo => z, :bar => 42}
x << a
y << c
z << b
- b.send(@method, c).should == true # they clearly have the same structure!
- y.send(@method, z).should == true
- a.send(@method, b).should == true # subtle, but they both have the same structure!
- x.send(@method, y).should == true
+ b.send(@method, c).should be_true # they clearly have the same structure!
+ y.send(@method, z).should be_true
+ a.send(@method, b).should be_true # subtle, but they both have the same structure!
+ x.send(@method, y).should be_true
y << x
- y.send(@method, z).should == false
+ y.send(@method, z).should be_false
z << x
- y.send(@method, z).should == true
-
+ y.send(@method, z).should be_true
+
a[:foo], a[:bar] = a[:bar], a[:foo]
- a.send(@method, b).should == false
+ a.send(@method, b).should be_false
b[:bar] = b[:foo]
- b.send(@method, c).should == false
+ b.send(@method, c).should be_false
end
end # ruby_bug
end
@@ -114,7 +113,7 @@
def y.==(o) false end
def x.eql?(o) false end
def y.eql?(o) false end
- new_hash(1 => x).send(@method, new_hash(1 => y)).should == false
+ new_hash(1 => x).send(@method, new_hash(1 => y)).should be_false
x = mock('x')
y = mock('y')
@@ -122,47 +121,37 @@
def y.==(o) true end
def x.eql?(o) true end
def y.eql?(o) true end
- new_hash(1 => x).send(@method, new_hash(1 => y)).should == true
+ new_hash(1 => x).send(@method, new_hash(1 => y)).should be_true
end
-
+
it "compares keys with eql? semantics" do
- new_hash(1.0 => "x").send(@method, new_hash(1.0 => "x")).should == true
- new_hash(1.0 => "x").send(@method, new_hash(1.0 => "x")).should == true
- new_hash(1 => "x").send(@method, new_hash(1.0 => "x")).should == false
- new_hash(1.0 => "x").send(@method, new_hash(1 => "x")).should == false
+ new_hash(1.0 => "x").send(@method, new_hash(1.0 => "x")).should be_true
+ new_hash(1.0 => "x").send(@method, new_hash(1.0 => "x")).should be_true
+ new_hash(1 => "x").send(@method, new_hash(1.0 => "x")).should be_false
+ new_hash(1.0 => "x").send(@method, new_hash(1 => "x")).should be_false
end
-
- it "returns true if other Hash has the same number of keys and each key-value pair matches" do
- new_hash(5).send(@method, new_hash(1)).should == true
- new_hash {|h, k| 1}.send(@method, new_hash {}).should == true
- new_hash {|h, k| 1}.send(@method, new_hash(2)).should == true
+ it "returns true iff other Hash has the same number of keys and each key-value pair matches" do
a = new_hash(:a => 5)
b = new_hash
- a.send(@method, b).should == false
+ a.send(@method, b).should be_false
b[:a] = 5
- a.send(@method, b).should == true
+ a.send(@method, b).should be_true
c = new_hash("a" => 5)
- a.send(@method, c).should == false
+ a.send(@method, c).should be_false
+ end
- d = new_hash {|h, k| 1}
- e = new_hash {}
- d[1] = 2
- e[1] = 2
- d.send(@method, e).should == true
- end
-
it "does not call to_hash on hash subclasses" do
- new_hash(5 => 6).send(@method, ToHashHash[5 => 6]).should == true
+ new_hash(5 => 6).send(@method, ToHashHash[5 => 6]).should be_true
end
it "ignores hash class differences" do
h = new_hash(1 => 2, 3 => 4)
- MyHash[h].send(@method, h).should == true
- MyHash[h].send(@method, MyHash[h]).should == true
- h.send(@method, MyHash[h]).should == true
+ MyHash[h].send(@method, h).should be_true
+ MyHash[h].send(@method, MyHash[h]).should be_true
+ h.send(@method, MyHash[h]).should be_true
end
# Why isn't this true of eql? too ?
@@ -186,9 +175,9 @@
obj
end
- new_hash(a[0] => 1).send(@method, new_hash(a[1] => 1)).should == false
- a[0].tainted?.should == true
- a[1].tainted?.should == true
+ new_hash(a[0] => 1).send(@method, new_hash(a[1] => 1)).should be_false
+ a[0].tainted?.should be_true
+ a[1].tainted?.should be_true
a = Array.new(2) do
obj = mock('0')
@@ -203,8 +192,22 @@
obj
end
- new_hash(a[0] => 1).send(@method, new_hash(a[1] => 1)).should == true
- a[0].tainted?.should == true
- a[1].tainted?.should == true
+ new_hash(a[0] => 1).send(@method, new_hash(a[1] => 1)).should be_true
+ a[0].tainted?.should be_true
+ a[1].tainted?.should be_true
end
-end
\ No newline at end of file
+end
+
+describe :hash_eql_additional_more, :shared => true do
+ it "returns true if other Hash has the same number of keys and each key-value pair matches, even though the default-value are not same" do
+ new_hash(5).send(@method, new_hash(1)).should be_true
+ new_hash {|h, k| 1}.send(@method, new_hash {}).should be_true
+ new_hash {|h, k| 1}.send(@method, new_hash(2)).should be_true
+
+ d = new_hash {|h, k| 1}
+ e = new_hash {}
+ d[1] = 2
+ e[1] = 2
+ d.send(@method, e).should be_true
+ end
+end
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/shared/to_s.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/shared/to_s.rb 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/shared/to_s.rb 2009-06-05 15:47:47 UTC (rev 1748)
@@ -27,7 +27,7 @@
# There is an inconsistency in the behaviour of #to_s/#inspect on 1.9.1.
# ujihisa fixed it and we're waiting for his patch to be committed. See
# http://redmine.ruby-lang.org/issues/show/1533 for details.
- ruby_bug "1533", "1.9.1.129" do
+ ruby_bug "1533", "1.9.1.154" do
it "handles recursive hashes" do
x = new_hash
x[0] = x
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/to_a_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/to_a_spec.rb 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/to_a_spec.rb 2009-06-05 15:47:47 UTC (rev 1748)
@@ -6,8 +6,8 @@
h = new_hash(:a => 1, 1 => :a, 3 => :b, :b => 5)
pairs = []
- h.each_pair do |*pair|
- pairs << pair
+ h.each_pair do |key, value|
+ pairs << [key, value]
end
h.to_a.class.should == Array
Modified: MacRuby/branches/experimental/spec/frozen/core/io/foreach_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/io/foreach_spec.rb 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/core/io/foreach_spec.rb 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1,3 +1,4 @@
+# encoding: utf-8
require File.dirname(__FILE__) + '/../../spec_helper'
describe "IO::foreach" do
@@ -100,13 +101,26 @@
lines.should == @content
end
- it "converts second parameter to string and uses as separator" do
- (obj = mock('r')).should_receive(:to_str).and_return('r')
- lines = []
- IO::foreach(@file, obj) do |line|
- lines << line
+ ruby_version_is "" ... "1.9" do
+ it "converts second parameter to string and uses as separator, with a to_str calling for the IO" do
+ (obj = mock('r')).should_receive(:to_str).once.and_return('r')
+ lines = []
+ IO::foreach(@file, obj) do |line|
+ lines << line
+ end
+ lines.should == @content_with_r
end
- lines.should == @content_with_r
end
+
+ ruby_version_is "1.9" do
+ it "converts second parameter to string and uses as separator, with each to_str calling for each lines of the IOs" do
+ num_lines = 6 # File.read(@file).lines.to_a.size #=> 6
+ (obj = mock('r')).should_receive(:to_str).exactly(num_lines).times.and_return('r')
+ lines = []
+ IO::foreach(@file, obj) do |line|
+ lines << line
+ end
+ lines.should == @content_with_r
+ end
+ end
end
-
Modified: MacRuby/branches/experimental/spec/frozen/core/io/putc_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/io/putc_spec.rb 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/core/io/putc_spec.rb 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1,3 +1,4 @@
+# encoding: utf-8
require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'
Modified: MacRuby/branches/experimental/spec/frozen/core/io/puts_spec_disabled.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/io/puts_spec_disabled.rb 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/core/io/puts_spec_disabled.rb 2009-06-05 15:47:47 UTC (rev 1748)
@@ -19,12 +19,22 @@
lambda { $stdout.puts "\n" }.should output_to_fd("\n", STDOUT)
end
- it "writes nil with a newline when given nil as an arg" do
- @io.should_receive(:write).with("nil")
- @io.should_receive(:write).with("\n")
- @io.puts(nil).should == nil
+ ruby_version_is "" ... "1.9" do
+ it "writes nil with a newline when given nil as an arg" do
+ @io.should_receive(:write).with("nil")
+ @io.should_receive(:write).with("\n")
+ @io.puts(nil).should == nil
+ end
end
+ ruby_version_is "1.9" do
+ it "writes empty string with a newline when given nil as an arg" do
+ @io.should_receive(:write).with("")
+ @io.should_receive(:write).with("\n")
+ @io.puts(nil).should == nil
+ end
+ end
+
it "calls to_s before writing non-string objects" do
object = mock('hola')
object.should_receive(:to_s).and_return("hola")
Modified: MacRuby/branches/experimental/spec/frozen/core/io/readchar_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/io/readchar_spec.rb 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/core/io/readchar_spec.rb 2009-06-05 15:47:47 UTC (rev 1748)
@@ -23,7 +23,7 @@
end
ruby_version_is "1.9" do
- it "returns the next character from the stream" do
+ it "returns the next string from the stream" do
@file.readchar.should == 'V'
@file.readchar.should == 'o'
@file.readchar.should == 'i'
Modified: MacRuby/branches/experimental/spec/frozen/core/io/readlines_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/io/readlines_spec.rb 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/core/io/readlines_spec.rb 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1,3 +1,4 @@
+# encoding: utf-8
require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'
@@ -5,7 +6,7 @@
before(:each) do
@io = File.open(File.dirname(__FILE__) + '/fixtures/readlines.txt')
end
-
+
after(:each) do
@io.close
end
@@ -26,7 +27,7 @@
@io.readlines
@io.pos.should eql(134)
end
-
+
it "updates self's lineno based on the number of lines read" do
@io.readlines
@io.lineno.should eql(6)
@@ -48,11 +49,11 @@
before(:each) do
@io = File.open(File.dirname(__FILE__) + '/fixtures/readlines.txt')
end
-
+
after(:each) do
@io.close
end
-
+
it "returns an Array containing lines based on the passed separator" do
@io.readlines('r').should == [
"Voici la ligne une.\nQui \303\250 la linea due.\nAqu\303\255 est\303\241 la l\303\255nea tr",
@@ -95,7 +96,7 @@
"Aqu\303\255 est\303\241 la l\303\255nea tres.\n" +
"Ist hier Linie vier.\nEst\303\241 aqui a linha cinco.\nHere is line six.\n"]
end
-
+
it "tries to convert the passed separator to a String using #to_str" do
obj = mock('to_str')
obj.stub!(:to_str).and_return("r")
@@ -166,7 +167,7 @@
before(:each) do
@file = File.dirname(__FILE__) + '/fixtures/readlines.txt'
end
-
+
it "returns an Array containing lines of file_name based on the passed separator" do
IO.readlines(@file, 'r').should == [
"Voici la ligne une.\nQui \303\250 la linea due.\nAqu\303\255 est\303\241 la l\303\255nea tr",
@@ -186,7 +187,7 @@
para_file = File.dirname(__FILE__) + '/fixtures/paragraphs.txt'
IO.readlines(para_file, "").should == ["This is\n\n", "an example\n\n", "of paragraphs."]
end
-
+
it "tries to convert the passed separator to a String using #to_str" do
obj = mock('to_str')
obj.stub!(:to_str).and_return("r")
Modified: MacRuby/branches/experimental/spec/frozen/core/io/shared/each.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/io/shared/each.rb 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/core/io/shared/each.rb 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1,3 +1,4 @@
+# encoding: utf-8
require File.dirname(__FILE__) + '/../fixtures/classes'
describe(:io_each, {:shared => true}) do
@@ -4,11 +5,11 @@
before(:each) do
@io = File.open(IOSpecs.gets_fixtures)
end
-
+
after(:each) do
@io.close
end
-
+
it "yields each line to the passed block" do
seen = []
@io.send(@method) {|s| seen << s }
@@ -21,7 +22,7 @@
"Est\303\241 aqui a linha cinco.\n",
"Here is line six.\n"]
end
-
+
it "yields each line starting from the current position" do
seen = []
@io.pos = 40
@@ -52,7 +53,7 @@
it "returns self" do
@io.send(@method) {|l| l }.should equal(@io)
end
-
+
it "raises an IOError when self is not readable" do
# method must have a block in order to raise the IOError.
# MRI 1.8.7 returns enumerator if block is not provided.
@@ -70,7 +71,7 @@
it "returns an Enumerator when passed no block" do
enum = @io.send(@method)
enum.instance_of?(enumerator_class).should be_true
-
+
seen = []
enum.each { |b| seen << b }
seen.should == ["Voici la ligne une.\n",
@@ -89,7 +90,7 @@
before(:each) do
@io = File.open(IOSpecs.gets_fixtures)
end
-
+
after(:each) do
@io.close
end
@@ -102,7 +103,7 @@
"tres.\nIst ", "hier ", "Linie ", "vier.\n\nEst\303\241 ", "aqui ", "a ",
"linha ", "cinco.\nHere ", "is ", "line ", "six.\n"]
end
-
+
it "does not change $_" do
$_ = "test"
@io.send(@method, " ") { |s| s}
@@ -116,7 +117,7 @@
it "tries to convert the passed separator to a String using #to_str" do
obj = mock("to_str")
obj.stub!(:to_str).and_return(" ")
-
+
seen = []
@io.send(@method, obj) { |l| seen << l }
seen.should == ["Voici ", "la ", "ligne ", "une.\nQui ", "\303\250 ", "la ",
@@ -131,7 +132,7 @@
@io.send(@method, nil) {|s| seen << s}
seen.should == ["qui a linha cinco.\nHere is line six.\n"]
end
-
+
it "yields each paragraph when passed an empty String as separator" do
seen = []
para_file = File.dirname(__FILE__) + '/../fixtures/paragraphs.txt'
Modified: MacRuby/branches/experimental/spec/frozen/core/io/shared/new.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/io/shared/new.rb 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/core/io/shared/new.rb 2009-06-05 15:47:47 UTC (rev 1748)
@@ -68,11 +68,24 @@
lambda { IO.send(@method, fd, 'w') }.should raise_error(Errno::EBADF)
end
- it "raises EINVAL if mode is not compatible with the descriptor's current mode" do
- lambda { IO.send(@method, @file.fileno, 'r') }.should raise_error(Errno::EINVAL)
- lambda { io = IO.send(@method, @file.fileno, 'w'); io.close }.should_not raise_error
+ ruby_version_is "" ... "1.9" do
+ it "raises EINVAL if mode is not compatible with the descriptor's current mode" do
+ lambda { IO.send(@method, @file.fileno, 'r') }.
+ should raise_error(Errno::EINVAL)
+ lambda { io = IO.send(@method, @file.fileno, 'w'); io.close }.
+ should_not raise_error
+ end
end
+ ruby_version_is "1.9" do
+ it "does not raise EINVAL even if mode is not compatible with the descriptor's current mode" do
+ lambda { IO.send(@method, @file.fileno, 'r') }.
+ should_not raise_error(Errno::EINVAL)
+ lambda { io = IO.send(@method, @file.fileno, 'w'); io.close }.
+ should_not raise_error
+ end
+ end
+
it "raises IOError on closed stream" do
lambda { IO.new(IOSpecs.closed_file.fileno, 'w') }.should raise_error(IOError)
end
@@ -106,7 +119,15 @@
io.close
end
+ ruby_version_is "" ... "1.9" do
it "cannot open an IO with incompatible flags" do
lambda { IO.new(@file.fileno, "r") }.should raise_error
end
+ end
+
+ ruby_version_is "1.9" do
+ it "can open an IO with incompatible flags" do
+ lambda { IO.new(@file.fileno, "r") }.should_not raise_error
+ end
+ end
end
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/clear_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/clear_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/clear_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1 +0,0 @@
-fails:Hash#clear raises a TypeError if called on a frozen instance
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/default_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/default_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/default_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1 +0,0 @@
-fails:Hash#default= raises a TypeError if called on a frozen instance
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/delete_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/delete_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/delete_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1 +0,0 @@
-fails:Hash#delete raises a TypeError if called on a frozen instance
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/each_key_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/each_key_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/each_key_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1,2 +0,0 @@
-fails:Hash#each_key returns an Enumerator if called on a non-empty hash without a block
-fails:Hash#each_key returns an Enumerator if called on an empty hash without a block
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/each_pair_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/each_pair_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/each_pair_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1,3 +0,0 @@
-fails:Hash#each_pair processes all pairs, yielding two arguments: key and value
-fails:Hash#each_pair returns an Enumerator if called on a non-empty hash without a block
-fails:Hash#each_pair returns an Enumerator if called on an empty hash without a block
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/each_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/each_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/each_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1,2 +0,0 @@
-fails:Hash#each returns an Enumerator if called on a non-empty hash without a block
-fails:Hash#each returns an Enumerator if called on an empty hash without a block
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/each_value_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/each_value_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/each_value_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1,2 +0,0 @@
-fails:Hash#each_value returns an Enumerator if called on a non-empty hash without a block
-fails:Hash#each_value returns an Enumerator if called on an empty hash without a block
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/element_set_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/element_set_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/element_set_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1 +0,0 @@
-fails:Hash#[]= raises a TypeError if called on a frozen instance
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/indexes_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/indexes_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/indexes_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1 +0,0 @@
-fails:Hash#indexes returns an array of values for the given keys
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/indices_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/indices_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/indices_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1 +0,0 @@
-fails:Hash#indices returns an array of values for the given keys
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/initialize_copy_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/initialize_copy_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/initialize_copy_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1 +0,0 @@
-fails:Hash#initialize_copy raises a TypeError if called on a frozen instance
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/initialize_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/initialize_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/initialize_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1 +0,0 @@
-fails:Hash#initialize raises a TypeError if called on a frozen instance
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/merge_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/merge_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/merge_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1,3 +0,0 @@
-critical:Hash#merge! does not affect yielded items by removing the current element
-fails:Hash#merge processes entries with same order as each()
-fails:Hash#merge! raises a TypeError if called on a non-empty, frozen instance
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/rehash_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/rehash_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/rehash_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1 +0,0 @@
-fails:Hash#rehash raises a TypeError if called on a frozen instance
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/replace_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/replace_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/replace_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1 +0,0 @@
-fails:Hash#replace raises a TypeError if called on a frozen instance
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/select_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/select_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/select_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1,2 +0,0 @@
-fails:Hash#select returns an Enumerator when called on a non-empty hash without a block
-fails:Hash#select returns an Enumerator when called on an empty hash without a block
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/shift_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/shift_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/shift_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1 +0,0 @@
-fails:Hash#shift raises a TypeError if called on a frozen instance
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/store_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/store_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/store_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1 +0,0 @@
-fails:Hash#store raises a TypeError if called on a frozen instance
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/to_a_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/to_a_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/to_a_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1 +0,0 @@
-fails:Hash#to_a returns a list of [key, value] pairs with same order as each()
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/to_s_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/to_s_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/to_s_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1 +0,0 @@
-fails:Hash#to_s returns a string by calling Hash#to_a and using Array#join with default separator
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/update_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/update_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/update_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1,2 +0,0 @@
-critical:Hash#update does not affect yielded items by removing the current element
-fails:Hash#update raises a TypeError if called on a non-empty, frozen instance
Modified: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/io/foreach_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/io/foreach_tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/io/foreach_tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -4,3 +4,4 @@
fails:IO::foreach updates $. with each yield
fails:IO::foreach can handle non-ASCII data as separator
fails:IO::foreach converts second parameter to string and uses as separator
+fails:IO::foreach converts second parameter to string and uses as separator, with each to_str calling for each lines of the IOs
Deleted: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/kernel/__callee___tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/kernel/__callee___tags.txt 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/kernel/__callee___tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1,9 +0,0 @@
-critical:Kernel.__callee__ returns the current method, even when aliased
-critical:Kernel.__callee__ returns the original name when aliased method
-fails:Kernel.__callee__ returns the caller from blocks too
-fails:Kernel.__callee__ returns the caller from define_method too
-fails:Kernel.__callee__ returns the caller from block inside define_method too
-fails:Kernel.__callee__ returns the caller from a define_method called from the same class
-fails:Kernel.__callee__ returns method name even from eval
-fails:Kernel.__callee__ returns the original name when aliased method
-fails:Kernel.__callee__ returns the caller from blocks too
Copied: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/kernel/__callee__tags.txt (from rev 1747, MacRuby/branches/experimental/spec/frozen/tags/macruby/core/kernel/__callee___tags.txt)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/kernel/__callee__tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/kernel/__callee__tags.txt 2009-06-05 15:47:47 UTC (rev 1748)
@@ -0,0 +1,9 @@
+critical:Kernel.__callee__ returns the current method, even when aliased
+critical:Kernel.__callee__ returns the original name when aliased method
+fails:Kernel.__callee__ returns the caller from blocks too
+fails:Kernel.__callee__ returns the caller from define_method too
+fails:Kernel.__callee__ returns the caller from block inside define_method too
+fails:Kernel.__callee__ returns the caller from a define_method called from the same class
+fails:Kernel.__callee__ returns method name even from eval
+fails:Kernel.__callee__ returns the original name when aliased method
+fails:Kernel.__callee__ returns the caller from blocks too
Modified: MacRuby/branches/experimental/spec/frozen/upstream
===================================================================
--- MacRuby/branches/experimental/spec/frozen/upstream 2009-06-05 07:18:57 UTC (rev 1747)
+++ MacRuby/branches/experimental/spec/frozen/upstream 2009-06-05 15:47:47 UTC (rev 1748)
@@ -1 +1 @@
-93497d7fc3909a8a6c892f1a79a0ca6a1239d247
\ No newline at end of file
+9153e76040d7393521a4980f8b285ecb11e0df91
\ No newline at end of file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090605/8f0aebc8/attachment-0001.html>
More information about the macruby-changes
mailing list