[macruby-changes] [1728] MacRuby/branches/experimental/spec/frozen
source_changes at macosforge.org
source_changes at macosforge.org
Thu Jun 4 16:20:48 PDT 2009
Revision: 1728
http://trac.macosforge.org/projects/ruby/changeset/1728
Author: eloy.de.enige at gmail.com
Date: 2009-06-04 16:20:47 -0700 (Thu, 04 Jun 2009)
Log Message:
-----------
Updated rubyspec to 93497d7fc3909a8a6c892f1a79a0ca6a1239d247
Modified Paths:
--------------
MacRuby/branches/experimental/spec/frozen/core/array/concat_spec.rb
MacRuby/branches/experimental/spec/frozen/core/array/delete_spec.rb
MacRuby/branches/experimental/spec/frozen/core/array/flatten_spec.rb
MacRuby/branches/experimental/spec/frozen/core/array/initialize_spec.rb
MacRuby/branches/experimental/spec/frozen/core/array/insert_spec.rb
MacRuby/branches/experimental/spec/frozen/core/array/pack_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/array/push_spec.rb
MacRuby/branches/experimental/spec/frozen/core/array/uniq_spec.rb
MacRuby/branches/experimental/spec/frozen/core/array/unshift_spec.rb
MacRuby/branches/experimental/spec/frozen/core/dir/each_spec.rb
MacRuby/branches/experimental/spec/frozen/core/dir/foreach_spec.rb
MacRuby/branches/experimental/spec/frozen/core/hash/clear_spec.rb
MacRuby/branches/experimental/spec/frozen/core/hash/default_spec.rb
MacRuby/branches/experimental/spec/frozen/core/hash/delete_if_spec.rb
MacRuby/branches/experimental/spec/frozen/core/hash/each_pair_spec.rb
MacRuby/branches/experimental/spec/frozen/core/hash/each_spec.rb
MacRuby/branches/experimental/spec/frozen/core/hash/initialize_spec.rb
MacRuby/branches/experimental/spec/frozen/core/hash/merge_spec.rb
MacRuby/branches/experimental/spec/frozen/core/hash/rehash_spec.rb
MacRuby/branches/experimental/spec/frozen/core/hash/reject_spec.rb
MacRuby/branches/experimental/spec/frozen/core/hash/shared/replace.rb
MacRuby/branches/experimental/spec/frozen/core/hash/shared/store.rb
MacRuby/branches/experimental/spec/frozen/core/hash/shared/update.rb
MacRuby/branches/experimental/spec/frozen/core/kernel/Integer_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/chomp_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/chop_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/count_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/delete_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/dump_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/element_set_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/gsub_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/include_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/insert_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/inspect_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/ljust_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/lstrip_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/modulo_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/replace_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/reverse_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/rjust_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/rstrip_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/slice_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/squeeze_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/strip_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/sub_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/to_i_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/unpack_spec.rb
MacRuby/branches/experimental/spec/frozen/library/resolv/get_address_spec.rb
MacRuby/branches/experimental/spec/frozen/library/set/divide_spec.rb
MacRuby/branches/experimental/spec/frozen/library/socket/ipsocket/getaddress_spec.rb
MacRuby/branches/experimental/spec/frozen/ruby.1.9.mspec
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/element_set_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/sub_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/concat_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/flatten_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/initialize_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/insert_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/push_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/hash/initialize_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/chop_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/gsub_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/modulo_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/replace_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/sub_tags.txt
MacRuby/branches/experimental/spec/frozen/upstream
Added Paths:
-----------
MacRuby/branches/experimental/spec/frozen/core/hash/shared/each.rb
MacRuby/branches/experimental/spec/frozen/ruby.1.9.mspec.orig
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/unshift_tags.txt
Removed Paths:
-------------
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/delete_if_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/matchdata/to_a_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/chop_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/count_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/delete_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/downcase_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/dump_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/each_line_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/each_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/include_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/insert_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/inspect_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/intern_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/ljust_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/lstrip_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/modulo_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/next_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/replace_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/reverse_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/rjust_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/rstrip_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/squeeze_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/strip_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/succ_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/swapcase_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/to_i_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/tr_s_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/tr_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/unpack_tags.txt
Modified: MacRuby/branches/experimental/spec/frozen/core/array/concat_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/array/concat_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/array/concat_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -39,13 +39,18 @@
end
ruby_version_is '1.9' do
- it "raises a RuntimeError when Array is frozen and modification occurs" do
- lambda { ArraySpecs.frozen_array.concat [1] }.should raise_error(RuntimeError)
+ ruby_bug "[ruby-core:23666]", "1.9.2" do
+ it "raises a RuntimeError when Array is frozen and modification occurs" do
+ lambda { ArraySpecs.frozen_array.concat [1] }.should raise_error(RuntimeError)
+ lambda { ArraySpecs.frozen_array.concat([]) }.should raise_error(RuntimeError)
+ end
end
end
- it "does not raise a TypeError when Array is frozen but no modification occurs" do
- ArraySpecs.frozen_array.concat([]).should == [1, 2, 3]
+ ruby_version_is ""..."1.9" do
+ it "does not raise a TypeError when Array is frozen but no modification occurs" do
+ ArraySpecs.frozen_array.concat([]).should == [1, 2, 3]
+ end
end
it "keeps tainted status" do
Modified: MacRuby/branches/experimental/spec/frozen/core/array/delete_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/array/delete_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/array/delete_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -34,18 +34,18 @@
it "raises a TypeError on a frozen array if a modification would take place" do
lambda { [1, 2, 3].freeze.delete(1) }.should raise_error(TypeError)
end
+
+ it "returns false on a frozen array if a modification does not take place" do
+ [1, 2, 3].freeze.delete(0).should == nil
+ end
end
ruby_version_is '1.9' do
- it "raises a RuntimeError on a frozen array if a modification would take place" do
+ it "raises a RuntimeError on a frozen array" do
lambda { [1, 2, 3].freeze.delete(1) }.should raise_error(RuntimeError)
end
end
- it "returns false on a frozen array if a modification does not take place" do
- [1, 2, 3].freeze.delete(0).should == nil
- end
-
it "keeps tainted status" do
a = [1, 2]
a.taint
Modified: MacRuby/branches/experimental/spec/frozen/core/array/flatten_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/array/flatten_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/array/flatten_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -190,17 +190,20 @@
nested_ary.freeze
lambda { nested_ary.flatten! }.should raise_error(TypeError)
end
+
+ it "does not raise on frozen arrays when no modification would take place" do
+ ArraySpecs.frozen_array.flatten!.should be_nil
+ end
end
ruby_version_is '1.9' do
- it "raises a RuntimeError on frozen arrays when modification would take place" do
- nested_ary = [1, 2, []]
- nested_ary.freeze
- lambda { nested_ary.flatten! }.should raise_error(RuntimeError)
+ ruby_bug "[ruby-core:23663]", "1.9.2" do
+ it "raises a RuntimeError on frozen arrays" do
+ nested_ary = [1, 2, []]
+ nested_ary.freeze
+ lambda { nested_ary.flatten! }.should raise_error(RuntimeError)
+ lambda { ArraySpecs.frozen_array.flatten! }.should raise_error(RuntimeError)
+ end
end
end
-
- it "does not raise on frozen arrays when no modification would take place" do
- ArraySpecs.frozen_array.flatten!.should be_nil
- end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/array/initialize_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/array/initialize_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/array/initialize_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -44,7 +44,7 @@
end
ruby_version_is '1.9' do
- it "raises a RuntimeError on frozen arrays even if the array would not be modified" do
+ it "raises a RuntimeError on frozen arrays" do
lambda do
ArraySpecs.frozen_array.send :initialize
end.should raise_error(RuntimeError)
Modified: MacRuby/branches/experimental/spec/frozen/core/array/insert_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/array/insert_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/array/insert_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -71,15 +71,18 @@
it "raises a TypeError on frozen arrays if modification takes place" do
lambda { ArraySpecs.frozen_array.insert(0, 'x') }.should raise_error(TypeError)
end
+
+ it "does not raise on frozen arrays if no modification takes place" do
+ ArraySpecs.frozen_array.insert(0).should == [1, 2, 3]
+ end
end
ruby_version_is '1.9' do
- it "raises a RuntimeError on frozen arrays if modification takes place" do
- lambda { ArraySpecs.frozen_array.insert(0, 'x') }.should raise_error(RuntimeError)
+ ruby_bug "[ruby-core:23666]", "1.9.2" do
+ it "raises a RuntimeError on frozen arrays" do
+ lambda { ArraySpecs.frozen_array.insert(0, 'x') }.should raise_error(RuntimeError)
+ lambda { ArraySpecs.frozen_array.insert(0) }.should raise_error(RuntimeError)
+ end
end
end
-
- it "does not raise on frozen arrays if no modification takes place" do
- ArraySpecs.frozen_array.insert(0).should == [1, 2, 3]
- end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/array/pack_spec_disabled.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/array/pack_spec_disabled.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/array/pack_spec_disabled.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -174,7 +174,7 @@
it "raises a TypeError if array item is not String with ('A<count>')" do
lambda { [123].pack(format(5)) }.should raise_error(TypeError)
- lambda { [:hello].pack(format(5)) }.should raise_error(TypeError)
+ lambda { [[]].pack(format(5)) }.should raise_error(TypeError)
lambda { [mock('not string')].pack(format(5)) }.should raise_error(TypeError)
end
@@ -309,7 +309,7 @@
it "raises a TypeError if corresponding array item is not String" do
lambda { [123].pack('B8') }.should raise_error(TypeError)
- lambda { [:data].pack('B8') }.should raise_error(TypeError)
+ lambda { [[]].pack('B8') }.should raise_error(TypeError)
lambda { [mock('not string')].pack('B8') }.should raise_error(TypeError)
end
@@ -394,7 +394,7 @@
it "raises a TypeError if corresponding array item is not String" do
lambda { [123].pack('b8') }.should raise_error(TypeError)
- lambda { [:data].pack('b8') }.should raise_error(TypeError)
+ lambda { [[]].pack('b8') }.should raise_error(TypeError)
lambda { [mock('not string')].pack('b8') }.should raise_error(TypeError)
end
@@ -1551,14 +1551,18 @@
end
it "tries to convert the pack argument to a Float using #to_f" do
- obj = mock('to_f')
- obj.should_receive(:to_f).and_return(1.5)
- lambda{ [obj].pack(format) }.should_not raise_error
+ # 1.9 requires that the object actually be Numeric before calling #to_f on
+ # it; 1.8 doesn't care.
+ num = mock_numeric('number')
+ num.should_receive(:to_f).and_return(1.5)
+ lambda{ [num].pack(format) }.should_not raise_error
end
- it "accepts a string representation of real number as the pack argument" do
- lambda{ ["1.3333"].pack(format) }.should_not raise_error(TypeError)
- lambda{ ["-1.3333"].pack(format) }.should_not raise_error(TypeError)
+ ruby_version_is ""..."1.9" do
+ it "accepts a string representation of real number as the pack argument" do
+ lambda{ ["1.3333"].pack(format) }.should_not raise_error(TypeError)
+ lambda{ ["-1.3333"].pack(format) }.should_not raise_error(TypeError)
+ end
end
it "accepts an integer as the pack argument" do
@@ -2035,7 +2039,7 @@
it "raises a TypeError if corresponding array item is not string" do
lambda { [123].pack('m') }.should raise_error(TypeError)
- lambda { [:hello].pack('m') }.should raise_error(TypeError)
+ lambda { [[]].pack('m') }.should raise_error(TypeError)
lambda { [mock('not string')].pack('m') }.should raise_error(TypeError)
end
@@ -2195,7 +2199,7 @@
it "raises a TypeError if corresponding array item is not string" do
lambda { [123].pack('u') }.should raise_error(TypeError)
- lambda { [:hello].pack('u') }.should raise_error(TypeError)
+ lambda { [[]].pack('u') }.should raise_error(TypeError)
lambda { [mock('not string')].pack('u') }.should raise_error(TypeError)
end
Modified: MacRuby/branches/experimental/spec/frozen/core/array/push_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/array/push_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/array/push_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -36,12 +36,9 @@
end
ruby_version_is "1.9" do
- it "raises a RuntimeError on a frozen array if modification takes place" do
+ it "raises a RuntimeError on a frozen array" do
lambda { ArraySpecs.frozen_array.push(1) }.should raise_error(RuntimeError)
- end
-
- it "Raise a RuntimeError on a frozen array if no modification is made too" do
lambda { ArraySpecs.frozen_array.push }.should raise_error(RuntimeError)
- end
+ end
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/array/uniq_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/array/uniq_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/array/uniq_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -121,17 +121,21 @@
dup_ary.freeze
lambda { dup_ary.uniq! }.should raise_error(TypeError)
end
+
+ it "does not raise an exception on a frozen array if no modification takes place" do
+ ArraySpecs.frozen_array.uniq!.should be_nil
+ end
end
ruby_version_is "1.9" do
- it "raises a RuntimeError on a frozen array if modification would take place" do
- dup_ary = [1, 1, 2]
- dup_ary.freeze
- lambda { dup_ary.uniq! }.should raise_error(RuntimeError)
+ ruby_bug "[ruby-core:23666]", "1.9.2" do
+ it "raises a RuntimeError on a frozen array" do
+ dup_ary = [1, 1, 2]
+ dup_ary.freeze
+ lambda { dup_ary.uniq! }.should raise_error(RuntimeError)
+ lambda { ArraySpecs.frozen_array.uniq!}.should raise_error(RuntimeError)
+ end
end
end
- it "does not raise an exception on a frozen array if no modification takes place" do
- ArraySpecs.frozen_array.uniq!.should be_nil
- end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/array/unshift_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/array/unshift_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/array/unshift_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -46,12 +46,17 @@
end
ruby_version_is "1.9" do
- it "raises a RuntimeError on a frozen array" do
- lambda { ArraySpecs.frozen_array.unshift(1) }.should raise_error(RuntimeError)
+ ruby_bug "[ruby-core:23666]", "1.9.2" do
+ it "raises a RuntimeError on a frozen array" do
+ lambda { ArraySpecs.frozen_array.unshift(1) }.should raise_error(RuntimeError)
+ lambda { ArraySpecs.frozen_array.unshift }.should raise_error(RuntimeError)
+ end
end
end
- it "does not raise an exception on a frozen array if no modification takes place" do
- ArraySpecs.frozen_array.unshift.should == [1, 2, 3]
+ ruby_version_is ""..."1.9" do
+ it "does not raise an exception on a frozen array if no modification takes place" do
+ ArraySpecs.frozen_array.unshift.should == [1, 2, 3]
+ end
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/dir/each_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/dir/each_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/dir/each_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -36,7 +36,7 @@
ruby_version_is '1.8.7' do
it 'returns an Enumerator if no block given' do
@dir.each.should be_kind_of(enumerator_class)
- @dir.each.to_a.should == DirSpecs.expected_paths
+ @dir.each.to_a.sort.should == DirSpecs.expected_paths
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/dir/foreach_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/dir/foreach_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/dir/foreach_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -29,7 +29,7 @@
ruby_version_is '1.8.7' do
it 'returns an Enumerator if no block given' do
Dir.foreach(DirSpecs.mock_dir).should be_kind_of(enumerator_class)
- Dir.foreach(DirSpecs.mock_dir).to_a.should == DirSpecs.expected_paths
+ Dir.foreach(DirSpecs.mock_dir).to_a.sort.should == DirSpecs.expected_paths
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/clear_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/clear_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/clear_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -25,8 +25,16 @@
h.default_proc.should_not == nil
end
- it "raises a TypeError if called on a frozen instance" do
- lambda { HashSpecs.frozen_hash.clear }.should raise_error(TypeError)
- lambda { HashSpecs.empty_frozen_hash.clear }.should raise_error(TypeError)
+ ruby_version_is ""..."1.9" do
+ it "raises a TypeError if called on a frozen instance" do
+ lambda { HashSpecs.frozen_hash.clear }.should raise_error(TypeError)
+ lambda { HashSpecs.empty_frozen_hash.clear }.should raise_error(TypeError)
+ end
end
+ ruby_version_is "1.9" do
+ it "raises a RuntimeError if called on a frozen instance" do
+ lambda { HashSpecs.frozen_hash.clear }.should raise_error(RuntimeError)
+ lambda { HashSpecs.empty_frozen_hash.clear }.should raise_error(RuntimeError)
+ end
+ end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/default_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/default_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/default_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -39,8 +39,17 @@
end
end
- it "raises a TypeError if called on a frozen instance" do
- lambda { HashSpecs.frozen_hash.default = nil }.should raise_error(TypeError)
- lambda { HashSpecs.empty_frozen_hash.default = nil }.should raise_error(TypeError)
+ ruby_version_is ""..."1.9" do
+ it "raises a TypeError if called on a frozen instance" do
+ lambda { HashSpecs.frozen_hash.default = nil }.should raise_error(TypeError)
+ lambda { HashSpecs.empty_frozen_hash.default = nil }.should raise_error(TypeError)
+ end
end
+
+ ruby_version_is "1.9" do
+ it "raises a RuntimeError if called on a frozen instance" do
+ lambda { HashSpecs.frozen_hash.default = nil }.should raise_error(RuntimeError)
+ lambda { HashSpecs.empty_frozen_hash.default = nil }.should raise_error(RuntimeError)
+ end
+ end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/delete_if_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/delete_if_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/delete_if_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -21,8 +21,8 @@
each_pairs = []
delete_pairs = []
- h.each_pair { |*pair| each_pairs << pair }
- h.delete_if { |*pair| delete_pairs << pair }
+ h.each_pair { |k,v| each_pairs << [k, v] }
+ h.delete_if { |k,v| delete_pairs << [k,v] }
each_pairs.should == delete_pairs
end
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/each_pair_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/each_pair_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/each_pair_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,17 +1,33 @@
require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'
require File.dirname(__FILE__) + '/shared/iteration'
+require File.dirname(__FILE__) + '/shared/each'
describe "Hash#each_pair" do
- it "processes all pairs, yielding two arguments: key and value" do
- all_args = []
+ ruby_version_is ""..."1.9" do
+ it "yields the key and value of each pair to a block expecting |key, value|" do
+ all_args = []
- h = new_hash(1 => 2, 3 => 4)
- h2 = h.each_pair { |*args| all_args << args }
- h2.should equal(h)
+ h = new_hash(1 => 2, 3 => 4)
+ h2 = h.each_pair { |key, value| all_args << [key, value] }
+ h2.should equal(h)
- all_args.sort.should == [[1, 2], [3, 4]]
+ all_args.sort.should == [[1, 2], [3, 4]]
+ end
+
+ it "yields a [key, value] Array for each pair to a block expecting |*args|" do
+ all_args = []
+
+ h = new_hash(1 => 2, 3 => 4)
+ h2 = h.each_pair { |*args| all_args << args }
+ h2.should equal(h)
+
+ all_args.sort.should == [[1, 2], [3, 4]]
+ end
end
-
+
+ ruby_version_is "1.9" do
+ it_behaves_like(:hash_each, :each_pair)
+ end
it_behaves_like(:hash_iteration_no_block, :each_pair)
end
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/each_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/each_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/each_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,34 +1,9 @@
require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'
require File.dirname(__FILE__) + '/shared/iteration'
+require File.dirname(__FILE__) + '/shared/each'
describe "Hash#each" do
- it "yields one argument: [key, value]" do
- all_args = []
- new_hash(1 => 2, 3 => 4).each { |*args| all_args << args }
- all_args.sort.should == [[[1, 2]], [[3, 4]]]
- end
-
- it "calls block once for each entry, passing key, value" do
- r = new_hash
- h = new_hash(:a => 1, :b => 2, :c => 3, :d => 5)
- h.each { |k,v| r[k.to_s] = v.to_s }.should equal(h)
- r.should == new_hash("a" => "1", "b" => "2", "c" => "3", "d" => "5")
- end
-
- it "uses the same order as keys() and values()" do
- h = new_hash(:a => 1, :b => 2, :c => 3, :d => 5)
- keys = []
- values = []
-
- h.each do |k, v|
- keys << k
- values << v
- end
-
- keys.should == h.keys
- values.should == h.values
- end
-
+ it_behaves_like(:hash_each, :each)
it_behaves_like(:hash_iteration_no_block, :each)
end
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/initialize_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/initialize_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/initialize_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -19,17 +19,35 @@
NewHash.new(:one, :two)[1].should == :two
end
- it "raises a TypeError if called on a frozen instance" do
- block = lambda { HashSpecs.frozen_hash.instance_eval { initialize() }}
- block.should raise_error(TypeError)
+ ruby_version_is ""..."1.9" do
+ it "raises a TypeError if called on a frozen instance" do
+ block = lambda { HashSpecs.frozen_hash.instance_eval { initialize() }}
+ block.should raise_error(TypeError)
- block = lambda { HashSpecs.frozen_hash.instance_eval { initialize(nil) } }
- block.should raise_error(TypeError)
+ block = lambda { HashSpecs.frozen_hash.instance_eval { initialize(nil) } }
+ block.should raise_error(TypeError)
- block = lambda { HashSpecs.frozen_hash.instance_eval { initialize(5) } }
- block.should raise_error(TypeError)
+ block = lambda { HashSpecs.frozen_hash.instance_eval { initialize(5) } }
+ block.should raise_error(TypeError)
- block = lambda { HashSpecs.frozen_hash.instance_eval { initialize { 5 } } }
- block.should raise_error(TypeError)
+ block = lambda { HashSpecs.frozen_hash.instance_eval { initialize { 5 } } }
+ block.should raise_error(TypeError)
+ end
end
+
+ ruby_version_is "1.9" do
+ it "raises a RuntimeError if called on a frozen instance" do
+ block = lambda { HashSpecs.frozen_hash.instance_eval { initialize() }}
+ block.should raise_error(RuntimeError)
+
+ block = lambda { HashSpecs.frozen_hash.instance_eval { initialize(nil) } }
+ block.should raise_error(RuntimeError)
+
+ block = lambda { HashSpecs.frozen_hash.instance_eval { initialize(5) } }
+ block.should raise_error(RuntimeError)
+
+ block = lambda { HashSpecs.frozen_hash.instance_eval { initialize { 5 } } }
+ block.should raise_error(RuntimeError)
+ end
+ end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/merge_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/merge_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/merge_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -48,7 +48,7 @@
h = new_hash(1 => 2, 3 => 4, 5 => 6, "x" => nil, nil => 5, [] => [])
merge_pairs = []
each_pairs = []
- h.each_pair { |*pair| each_pairs << pair }
+ h.each_pair { |k, v| each_pairs << [k, v] }
h.merge(h) { |k, v1, v2| merge_pairs << [k, v1] }
merge_pairs.should == each_pairs
end
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/rehash_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/rehash_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/rehash_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -36,11 +36,20 @@
h[k2].should == v2
end
- it "raises a TypeError if called on a frozen instance" do
- lambda { HashSpecs.frozen_hash.rehash }.should raise_error(TypeError)
- lambda { HashSpecs.empty_frozen_hash.rehash }.should raise_error(TypeError)
+ ruby_version_is ""..."1.9" do
+ it "raises a TypeError if called on a frozen instance" do
+ lambda { HashSpecs.frozen_hash.rehash }.should raise_error(TypeError)
+ lambda { HashSpecs.empty_frozen_hash.rehash }.should raise_error(TypeError)
+ end
end
+ ruby_version_is "1.9" do
+ it "raises a RuntimeError if called on a frozen instance" do
+ lambda { HashSpecs.frozen_hash.rehash }.should raise_error(RuntimeError)
+ lambda { HashSpecs.empty_frozen_hash.rehash }.should raise_error(RuntimeError)
+ end
+ end
+
it "causes a RuntimeError to be raised if called inside an iterator block" do
[:delete_if, :each, :each_pair, :each_value,
:reject!, :select, :sort_by].each do |method|
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/reject_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/reject_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/reject_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -72,11 +72,20 @@
reject_bang_pairs.should == delete_if_pairs
end
- it "raises a TypeError if called on a frozen instance" do
- lambda { HashSpecs.frozen_hash.reject! { false } }.should raise_error(TypeError)
- lambda { HashSpecs.empty_frozen_hash.reject! { true } }.should raise_error(TypeError)
+ ruby_version_is ""..."1.9" do
+ it "raises a TypeError if called on a frozen instance" do
+ lambda { HashSpecs.frozen_hash.reject! { false } }.should raise_error(TypeError)
+ lambda { HashSpecs.empty_frozen_hash.reject! { true } }.should raise_error(TypeError)
+ end
end
+ ruby_version_is "1.9" do
+ it "raises a RuntimeError if called on a frozen instance" do
+ lambda { HashSpecs.frozen_hash.reject! { false } }.should raise_error(RuntimeError)
+ lambda { HashSpecs.empty_frozen_hash.reject! { true } }.should raise_error(RuntimeError)
+ end
+ end
+
ruby_version_is "" ... "1.8.7" do
it "raises a LocalJumpError when called on a non-empty hash without a block" do
lambda { @hsh.reject! }.should raise_error(LocalJumpError)
Added: MacRuby/branches/experimental/spec/frozen/core/hash/shared/each.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/shared/each.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/shared/each.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -0,0 +1,28 @@
+describe :hash_each, :shared => true do
+ it "yields a [[key, value]] Array for each pair to a block expecting |*args|" do
+ all_args = []
+ new_hash(1 => 2, 3 => 4).send(@method) { |*args| all_args << args }
+ all_args.sort.should == [[[1, 2]], [[3, 4]]]
+ end
+
+ it "yields the key and value of each pair to a block expecting |key, value|" do
+ r = new_hash
+ h = new_hash(:a => 1, :b => 2, :c => 3, :d => 5)
+ h.send(@method) { |k,v| r[k.to_s] = v.to_s }.should equal(h)
+ r.should == new_hash("a" => "1", "b" => "2", "c" => "3", "d" => "5")
+ end
+
+ it "uses the same order as keys() and values()" do
+ h = new_hash(:a => 1, :b => 2, :c => 3, :d => 5)
+ keys = []
+ values = []
+
+ h.send(@method) do |k, v|
+ keys << k
+ values << v
+ end
+
+ keys.should == h.keys
+ values.should == h.values
+ end
+end
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/shared/replace.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/shared/replace.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/shared/replace.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -37,9 +37,19 @@
hash_a.default.should == hash_b.default
end
- it "raises a TypeError if called on a frozen instance" do
- HashSpecs.frozen_hash.send(@method, HashSpecs.frozen_hash) # ok, nothing changed
- block = lambda { HashSpecs.frozen_hash.send(@method, HashSpecs.empty_frozen_hash) }
- block.should raise_error(TypeError)
+ ruby_version_is ""..."1.9" do
+ it "raises a TypeError if called on a frozen instance" do
+ HashSpecs.frozen_hash.send(@method, HashSpecs.frozen_hash) # ok, nothing changed
+ block = lambda { HashSpecs.frozen_hash.send(@method, HashSpecs.empty_frozen_hash) }
+ block.should raise_error(TypeError)
+ end
end
+
+ ruby_version_is "1.9" do
+ it "raises a RuntimeError if called on a frozen instance" do
+ HashSpecs.frozen_hash.send(@method, HashSpecs.frozen_hash) # ok, nothing changed
+ block = lambda { HashSpecs.frozen_hash.send(@method, HashSpecs.empty_frozen_hash) }
+ block.should raise_error(RuntimeError)
+ end
+ end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/shared/store.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/shared/store.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/shared/store.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -37,7 +37,15 @@
h.keys[0].frozen?.should == true
end
- it "raises a TypeError if called on a frozen instance" do
- lambda { HashSpecs.frozen_hash.send(@method, 1, 2) }.should raise_error(TypeError)
+ ruby_version_is ""..."1.9" do
+ it "raises a TypeError if called on a frozen instance" do
+ lambda { HashSpecs.frozen_hash.send(@method, 1, 2) }.should raise_error(TypeError)
+ end
end
+
+ ruby_version_is "1.9" do
+ it "raises a RuntimeError if called on a frozen instance" do
+ lambda { HashSpecs.frozen_hash.send(@method, 1, 2) }.should raise_error(RuntimeError)
+ end
+ end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/hash/shared/update.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/hash/shared/update.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/hash/shared/update.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -34,8 +34,17 @@
merge_bang_pairs.should == merge_pairs
end
- it "raises a TypeError if called on a non-empty, frozen instance" do
- HashSpecs.frozen_hash.send(@method, HashSpecs.empty_frozen_hash) # ok, empty
- lambda { HashSpecs.frozen_hash.send(@method, 1 => 2) }.should raise_error(TypeError)
+ ruby_version_is ""..."1.9" do
+ it "raises a TypeError if called on a non-empty, frozen instance" do
+ HashSpecs.frozen_hash.send(@method, HashSpecs.empty_frozen_hash) # ok, empty
+ lambda { HashSpecs.frozen_hash.send(@method, 1 => 2) }.should raise_error(TypeError)
+ end
end
+ ruby_version_is "1.9" do
+ it "raises a RuntimeError if called on a non-empty, frozen instance" do
+ HashSpecs.frozen_hash.send(@method, HashSpecs.empty_frozen_hash) # ok, empty
+ lambda { HashSpecs.frozen_hash.send(@method, 1 => 2) }.
+ should raise_error(RuntimeError)
+ end
+ end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/kernel/Integer_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/kernel/Integer_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/kernel/Integer_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -44,6 +44,18 @@
lambda { Integer(mock('x')) }.should raise_error(TypeError)
end
+ ruby_version_is ""..."1.9" do
+ it "returns 0 when passed nil" do
+ Integer(nil).should == 0
+ end
+ end
+
+ ruby_version_is "1.9" do
+ it "raises a TypeError when passed nil" do
+ lambda { Integer(nil) }.should raise_error(TypeError)
+ end
+ end
+
it "raises a TypeError if to_i doesn't return an Integer" do
(obj = mock('ha!')).should_receive(:to_i).and_return("ha!")
lambda { Integer(obj) }.should raise_error(TypeError)
Modified: MacRuby/branches/experimental/spec/frozen/core/string/chomp_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/chomp_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/chomp_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -147,14 +147,15 @@
end
ruby_version_is "1.9" do
- it "raises a RuntimeError when self is frozen" do
- a = "string\n\r"
- a.freeze
+ ruby_bug "[ruby-core:23666]", "1.9.2" do
+ it "raises a RuntimeError when self is frozen" do
+ a = "string\n\r"
+ a.freeze
- lambda { a.chomp! }.should raise_error(RuntimeError)
-
- a.chomp!(nil) # ok, no change
- a.chomp!("x") # ok, no change
+ lambda { a.chomp! }.should raise_error(RuntimeError)
+ lambda { a.chomp!(nil) }.should raise_error(RuntimeError)
+ lambda { a.chomp!("x") }.should raise_error(RuntimeError)
+ end
end
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/chop_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/chop_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/chop_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -2,21 +2,41 @@
require File.dirname(__FILE__) + '/fixtures/classes.rb'
describe "String#chop" do
- it "returns a new string with the last character removed" do
- "hello\n".chop.should == "hello"
- "hello\x00".chop.should == "hello"
- "hello".chop.should == "hell"
-
- ori_str = ""
- 256.times { |i| ori_str << i }
-
- str = ori_str
- 256.times do |i|
- str = str.chop
- str.should == ori_str[0, 255 - i]
+ ruby_version_is "".."1.9" do
+ it "returns a new string with the last character removed" do
+ "hello\n".chop.should == "hello"
+ "hello\x00".chop.should == "hello"
+ "hello".chop.should == "hell"
+
+ ori_str = ""
+ 256.times { |i| ori_str << i }
+
+ str = ori_str
+ 256.times do |i|
+ str = str.chop
+ p str
+ str.should == ori_str[0, 255 - i]
+ end
end
end
-
+
+ ruby_version_is "1.9" do
+ it "returns a new string with the last character removed" do
+ "hello\n".chop.should == "hello"
+ "hello\x00".chop.should == "hello"
+ "hello".chop.should == "hell"
+
+ ori_str = ""
+ 256.times { |i| ori_str.encode('UTF-8') << i }
+
+ str = ori_str
+ 256.times do |i|
+ str = str.chop
+ str.should == ori_str[0, 255 - i]
+ end
+ end
+ end
+
it "removes both characters if the string ends with \\r\\n" do
"hello\r\n".chop.should == "hello"
"hello\r\n\r\n".chop.should == "hello\r\n"
@@ -76,14 +96,16 @@
end
ruby_version_is "1.9" do
- it "raises a RuntimeError when self is frozen" do
- a = "string\n\r"
- a.freeze
- lambda { a.chop! }.should raise_error(RuntimeError)
+ ruby_bug "[ruby-core:23666]", "1.9.2" do
+ it "raises a RuntimeError when self is frozen" do
+ a = "string\n\r"
+ a.freeze
+ lambda { a.chop! }.should raise_error(RuntimeError)
- a = ""
- a.freeze
- a.chop! # ok, no change
+ a = ""
+ a.freeze
+ lambda { a.chop! }.should raise_error(RuntimeError)
+ end
end
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/count_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/count_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/count_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -89,7 +89,7 @@
it "raises a TypeError when a set arg can't be converted to a string" do
lambda { "hello world".count(100) }.should raise_error(TypeError)
- lambda { "hello world".count(:o) }.should raise_error(TypeError)
+ lambda { "hello world".count([]) }.should raise_error(TypeError)
lambda { "hello world".count(mock('x')) }.should raise_error(TypeError)
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/delete_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/delete_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/delete_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -69,7 +69,7 @@
it "raises a TypeError when one set arg can't be converted to a string" do
lambda { "hello world".delete(100) }.should raise_error(TypeError)
- lambda { "hello world".delete(:o) }.should raise_error(TypeError)
+ lambda { "hello world".delete([]) }.should raise_error(TypeError)
lambda { "hello world".delete(mock('x')) }.should raise_error(TypeError)
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/dump_spec_disabled.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/dump_spec_disabled.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/dump_spec_disabled.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -3,22 +3,35 @@
require File.dirname(__FILE__) + '/fixtures/classes.rb'
describe "String#dump" do
- # Older versions of MRI wrongly print \b as \010
- it "returns a string with nonprinting charaters replaced by escaped-numeric notation" do
- ("\000".."A").to_a.to_s.dump.should == "\"\\000\\001\\002\\003\\004\\005\\006\\a\\b\\t\\n\\v\\f\\r\\016\\017\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\e\\034\\035\\036\\037 !\\\"\\\#$%&'()*+,-./0123456789\""
+ ruby_version_is ""..."1.9" do
+ # Older versions of MRI wrongly print \b as \010
+ it "returns a string with nonprinting charaters replaced by escaped-numeric notation" do
+ ("\000".."A").to_a.to_s.dump.should == "\"\\000\\001\\002\\003\\004\\005\\006\\a\\b\\t\\n\\v\\f\\r\\016\\017\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\e\\034\\035\\036\\037 !\\\"\\\#$%&'()*+,-./0123456789\""
+ end
end
-
- it "ignores the $KCODE setting" do
- old_kcode = $KCODE
- begin
- $KCODE = "NONE"
- "äöü".dump.should == "\"\\303\\244\\303\\266\\303\\274\""
+ # This test is different on 1.9 for two reasons: 1) 1.9 uses a different
+ # format of escaping, 2) 1.9 changes the output of Array#to_s.
+ ruby_version_is "1.9" do
+ it "returns a string with nonprinting charaters replaced by \\x notation" do
+ ("\000".."A").to_a.join('').should == "\x00\x01\x02\x03\x04\x05\x06\a\b\t\n\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\e\x1C\x1D\x1E\x1F !\"\#$%&'()*+,-./0123456789:;<=>?@A"
+ end
+ end
- $KCODE = "UTF-8"
- "äöü".dump.should == "\"\\303\\244\\303\\266\\303\\274\""
- ensure
- $KCODE = old_kcode
+ # $KCODE is deprecated on 1.9
+ ruby_version_is ""..."1.9" do
+ it "ignores the $KCODE setting" do
+ old_kcode = $KCODE
+
+ begin
+ $KCODE = "NONE"
+ "äöü".dump.should == "\"\\303\\244\\303\\266\\303\\274\""
+
+ $KCODE = "UTF-8"
+ "äöü".dump.should == "\"\\303\\244\\303\\266\\303\\274\""
+ ensure
+ $KCODE = old_kcode
+ end
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/element_set_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/element_set_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/element_set_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -7,89 +7,81 @@
# String#[re, idx] = obj
# String#[str] = obj
-describe "String#[]= with index" do
- it "sets the code of the character at idx to char modulo 256" do
- a = "hello"
- a[0] = ?b
- a.should == "bello"
- a[-1] = ?a
- a.should == "bella"
- a[-1] = 0
- a.should == "bell\x00"
- a[-5] = 0
- a.should == "\x00ell\x00"
+ruby_version_is ""..."1.9" do
+ describe "String#[]= with index" do
+ it "sets the code of the character at idx to char modulo 256" do
+ a = "hello"
+ a[0] = ?b
+ a.should == "bello"
+ a[-1] = ?a
+ a.should == "bella"
+ a[-1] = 0
+ a.should == "bell\x00"
+ a[-5] = 0
+ a.should == "\x00ell\x00"
- a = "x"
- a[0] = ?y
- a.should == "y"
- a[-1] = ?z
- a.should == "z"
+ a = "x"
+ a[0] = ?y
+ a.should == "y"
+ a[-1] = ?z
+ a.should == "z"
- a[0] = 255
- a[0].should == 255
- a[0] = 256
- a[0].should == 0
- a[0] = 256 * 3 + 42
- a[0].should == 42
- a[0] = -214
- a[0].should == 42
- end
+ a[0] = 255
+ a[0].should == 255
+ a[0] = 256
+ a[0].should == 0
+ a[0] = 256 * 3 + 42
+ a[0].should == 42
+ a[0] = -214
+ a[0].should == 42
+ end
+
+ it "sets the code to char % 256" do
+ str = "Hello"
- it "raises an IndexError without changing self if idx is outside of self" do
- a = "hello"
+ str[0] = ?a + 256 * 3
+ str[0].should == ?a
+ str[0] = -200
+ str[0].should == 56
+ end
- lambda { a[20] = ?a }.should raise_error(IndexError)
- a.should == "hello"
+ it "raises an IndexError without changing self if idx is outside of self" do
+ a = "hello"
- lambda { a[-20] = ?a }.should raise_error(IndexError)
- a.should == "hello"
+ lambda { a[20] = ?a }.should raise_error(IndexError)
+ a.should == "hello"
- lambda { ""[0] = ?a }.should raise_error(IndexError)
- lambda { ""[-1] = ?a }.should raise_error(IndexError)
- end
+ lambda { a[-20] = ?a }.should raise_error(IndexError)
+ a.should == "hello"
- it "calls to_int on index" do
- str = "hello"
- str[0.5] = ?c
- str.should == "cello"
+ lambda { ""[0] = ?a }.should raise_error(IndexError)
+ lambda { ""[-1] = ?a }.should raise_error(IndexError)
+ end
- obj = mock('-1')
- obj.should_receive(:to_int).and_return(-1)
- str[obj] = ?y
- str.should == "celly"
- end
+ it "calls to_int on index" do
+ str = "hello"
+ str[0.5] = ?c
+ str.should == "cello"
- it "sets the code to char % 256" do
- str = "Hello"
+ obj = mock('-1')
+ obj.should_receive(:to_int).and_return(-1)
+ str[obj] = ?y
+ str.should == "celly"
+ end
- str[0] = ?a + 256 * 3
- str[0].should == ?a
- str[0] = -200
- str[0].should == 56
- end
+ it "doesn't call to_int on char" do
+ obj = mock('x')
+ obj.should_not_receive(:to_int)
+ lambda { "hi"[0] = obj }.should raise_error(TypeError)
+ end
- it "doesn't call to_int on char" do
- obj = mock('x')
- obj.should_not_receive(:to_int)
- lambda { "hi"[0] = obj }.should raise_error(TypeError)
- end
-
- ruby_version_is ""..."1.9" do
it "raises a TypeError when self is frozen" do
a = "hello"
a.freeze
lambda { a[0] = ?b }.should raise_error(TypeError)
end
- end
- ruby_version_is "1.9" do
- it "raises a RuntimeError when self is frozen" do
- a = "hello"
- a.freeze
-
- lambda { a[0] = ?b }.should raise_error(RuntimeError)
- end
end
end
@@ -176,7 +168,7 @@
end
it "raises a TypeError if other_str can't be converted to a String" do
- lambda { "test"[1] = :test }.should raise_error(TypeError)
+ lambda { "test"[1] = [] }.should raise_error(TypeError)
lambda { "test"[1] = mock('x') }.should raise_error(TypeError)
lambda { "test"[1] = nil }.should raise_error(TypeError)
end
@@ -253,7 +245,7 @@
it "raises a TypeError if other_str is a type other than String" do
lambda { "hello"[0, 2] = nil }.should raise_error(TypeError)
- lambda { "hello"[0, 2] = :bob }.should raise_error(TypeError)
+ lambda { "hello"[0, 2] = [] }.should raise_error(TypeError)
lambda { "hello"[0, 2] = 33 }.should raise_error(TypeError)
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/gsub_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/gsub_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/gsub_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -187,9 +187,9 @@
end
it "raises a TypeError when pattern can't be converted to a string" do
- lambda { "hello".gsub(:woot, "x") }.should raise_error(TypeError)
- lambda { "hello".gsub(?e, "x") }.should raise_error(TypeError)
- lambda { "hello".gsub(nil, "x") }.should raise_error(TypeError)
+ lambda { "hello".gsub([], "x") }.should raise_error(TypeError)
+ lambda { "hello".gsub(Object.new, "x") }.should raise_error(TypeError)
+ lambda { "hello".gsub(nil, "x") }.should raise_error(TypeError)
end
it "tries to convert replacement to a string using to_str" do
@@ -200,9 +200,9 @@
end
it "raises a TypeError when replacement can't be converted to a string" do
- lambda { "hello".gsub(/[aeiou]/, :woot) }.should raise_error(TypeError)
- lambda { "hello".gsub(/[aeiou]/, ?f) }.should raise_error(TypeError)
- lambda { "hello".gsub(/[aeiou]/, nil) }.should raise_error(TypeError)
+ lambda { "hello".gsub(/[aeiou]/, []) }.should raise_error(TypeError)
+ lambda { "hello".gsub(/[aeiou]/, Object.new) }.should raise_error(TypeError)
+ lambda { "hello".gsub(/[aeiou]/, nil) }.should raise_error(TypeError)
end
it "returns subclass instances when called on a subclass" do
@@ -368,13 +368,15 @@
end
ruby_version_is "1.9" do
- it "raises a RuntimeError when self is frozen" do
- s = "hello"
- s.freeze
-
- s.gsub!(/ROAR/, "x") # ok
- lambda { s.gsub!(/e/, "e") }.should raise_error(RuntimeError)
- lambda { s.gsub!(/[aeiou]/, '*') }.should raise_error(RuntimeError)
+ ruby_bug "[ruby-core:23666]", "1.9.2" do
+ it "raises a RuntimeError when self is frozen" do
+ s = "hello"
+ s.freeze
+
+ lambda { s.gsub!(/ROAR/, "x") }.should raise_error(RuntimeError)
+ lambda { s.gsub!(/e/, "e") }.should raise_error(RuntimeError)
+ lambda { s.gsub!(/[aeiou]/, '*') }.should raise_error(RuntimeError)
+ end
end
end
end
@@ -407,12 +409,14 @@
a.should == "hello"
end
- it "raises a RuntimeError when self is frozen" do
- s = "hello"
- s.freeze
+ ruby_bug "[ruby-core:23663]", "1.9" do
+ it "raises a RuntimeError when self is frozen" do
+ s = "hello"
+ s.freeze
- s.gsub!(/ROAR/) { "x" } # ok
- lambda { s.gsub!(/e/) { "e" } }.should raise_error(RuntimeError)
- lambda { s.gsub!(/[aeiou]/) { '*' } }.should raise_error(RuntimeError)
+ lambda { s.gsub!(/ROAR/) { "x" } }.should raise_error(RuntimeError)
+ lambda { s.gsub!(/e/) { "e" } }.should raise_error(RuntimeError)
+ lambda { s.gsub!(/[aeiou]/) { '*' } }.should raise_error(RuntimeError)
+ end
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/include_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/include_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/include_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -6,7 +6,7 @@
"hello".include?("lo").should == true
"hello".include?("ol").should == false
end
-
+
it "ignores subclass differences" do
"hello".include?(StringSpecs::MyString.new("lo")).should == true
StringSpecs::MyString.new("hello").include?("lo").should == true
@@ -21,25 +21,27 @@
end
it "raises a TypeError if other can't be converted to string" do
- lambda { "hello".include?(:lo) }.should raise_error(TypeError)
+ lambda { "hello".include?([]) }.should raise_error(TypeError)
lambda { "hello".include?(mock('x')) }.should raise_error(TypeError)
end
end
-describe "String#include? with Fixnum" do
- it "returns true if self contains the given char" do
- "hello".include?(?h).should == true
- "hello".include?(?z).should == false
- "hello".include?(0).should == false
+ruby_version_is ""..."1.9" do
+ describe "String#include? with Fixnum" do
+ it "returns true if self contains the given char" do
+ "hello".include?(?h).should == true
+ "hello".include?(?z).should == false
+ "hello".include?(0).should == false
+ end
+
+ it "uses fixnum % 256" do
+ "hello".include?(?h + 256 * 3).should == true
+ end
+
+ it "doesn't try to convert fixnum to an Integer using to_int" do
+ obj = mock('x')
+ obj.should_not_receive(:to_int)
+ lambda { "hello".include?(obj) }.should raise_error(TypeError)
+ end
end
-
- it "uses fixnum % 256" do
- "hello".include?(?h + 256 * 3).should == true
- end
-
- it "doesn't try to convert fixnum to an Integer using to_int" do
- obj = mock('x')
- obj.should_not_receive(:to_int)
- lambda { "hello".include?(obj) }.should raise_error(TypeError)
- end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/insert_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/insert_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/insert_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -50,8 +50,8 @@
end
it "raises a TypeError if other can't be converted to string" do
- lambda { "abcd".insert(-6, ?e) }.should raise_error(TypeError)
- lambda { "abcd".insert(-6, :sym) }.should raise_error(TypeError)
+ lambda { "abcd".insert(-6, Object.new)}.should raise_error(TypeError)
+ lambda { "abcd".insert(-6, []) }.should raise_error(TypeError)
lambda { "abcd".insert(-6, mock('x')) }.should raise_error(TypeError)
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/inspect_spec_disabled.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/inspect_spec_disabled.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/inspect_spec_disabled.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -3,34 +3,59 @@
require File.dirname(__FILE__) + '/fixtures/classes.rb'
describe "String#inspect" do
- # Older versions of MRI wrongly print \b as \010
- it "returns a string with nonprinting charaters replaced by escaped-numeric notation" do
- ("\000".."A").to_a.to_s.inspect.should == "\"\\000\\001\\002\\003\\004\\005\\006\\a\\b\\t\\n\\v\\f\\r\\016\\017\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\e\\034\\035\\036\\037 !\\\"\\\#$%&'()*+,-./0123456789\""
+ ruby_version_is ""..."1.9" do
+ # Older versions of MRI wrongly print \b as \010
+ it "returns a string with nonprinting charaters replaced by escaped-numeric notation" do
+ ("\000".."A").to_a.to_s.inspect.should == "\"\\000\\001\\002\\003\\004\\005\\006\\a\\b\\t\\n\\v\\f\\r\\016\\017\\020\\021\\022\\023\\024\\025\\026\\027\\030\\031\\032\\e\\034\\035\\036\\037 !\\\"\\\#$%&'()*+,-./0123456789\""
+ end
end
-
- it "produces different output based on $KCODE" do
- old_kcode = $KCODE
+ ruby_version_is "1.9" do
+ it "returns a string with nonprinting charaters replaced by \\x notation" do
+ ("\000".."A").to_a.join('').should == "\x00\x01\x02\x03\x04\x05\x06\a\b\t\n\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\e\x1C\x1D\x1E\x1F !\"\#$%&'()*+,-./0123456789:;<=>?@A"
+ end
+ end
- begin
- $KCODE = "NONE"
- "äöü".inspect.should == "\"\\303\\244\\303\\266\\303\\274\""
+ # $KCODE is deprecated/removed on 1.9
+ ruby_version_is ""..."1.9" do
+ it "produces different output based on $KCODE" do
+ old_kcode = $KCODE
- $KCODE = "UTF-8"
- "äöü".inspect.should == "\"äöü\""
- ensure
- $KCODE = old_kcode
+ begin
+ $KCODE = "NONE"
+ "äöü".inspect.should == "\"\\303\\244\\303\\266\\303\\274\""
+
+ $KCODE = "UTF-8"
+ "äöü".inspect.should == "\"äöü\""
+ ensure
+ $KCODE = old_kcode
+ end
end
+
+ it "can handle malformed UTF-8 string when $KCODE is UTF-8" do
+ old_kcode = $KCODE
+
+ begin
+ $KCODE = "UTF-8"
+ # malformed UTF-8 sequence
+ "\007äöüz\303".inspect.should == "\"\\aäöüz\\303\""
+ ensure
+ $KCODE = old_kcode
+ end
+ end
end
- it "can handle malformed UTF-8 string when $KCODE is UTF-8" do
- old_kcode = $KCODE
+ ruby_version_is "1.9" do
+ it "produces different output based on #force_encoding" do
+ "äöü".inspect.force_encoding('UTF-8').should ==
+ "\"\xC3\xA4\xC3\xB6\xC3\xBC\""
+ "äöü".inspect.force_encoding('ASCII').should ==
+ "\"äöü\"".force_encoding('ASCII')
+ end
- begin
- $KCODE = "UTF-8"
+ it "can handle malformed UTF-8 string for #force_encoding('UTF-8')" do
# malformed UTF-8 sequence
- "\007äöüz\303".inspect.should == "\"\\aäöüz\\303\""
- ensure
- $KCODE = old_kcode
+ "\007äöüz\303".inspect.force_encoding('UTF-8').should ==
+ "\"\\aäöüz\\xC3\"".force_encoding('UTF-8')
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/ljust_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/ljust_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/ljust_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -62,8 +62,8 @@
end
it "raises a TypeError when padstr can't be converted" do
- lambda { "hello".ljust(20, :sym) }.should raise_error(TypeError)
- lambda { "hello".ljust(20, ?c) }.should raise_error(TypeError)
+ lambda { "hello".ljust(20, []) }.should raise_error(TypeError)
+ lambda { "hello".ljust(20, Object.new)}.should raise_error(TypeError)
lambda { "hello".ljust(20, mock('x')) }.should raise_error(TypeError)
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/lstrip_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/lstrip_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/lstrip_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -48,9 +48,8 @@
ruby_version_is "1.9" do
ruby_bug "#1550", "1.9.2" do
it "raises a RuntimeError if self is frozen" do
- "hello".freeze.lstrip! # ok, nothing changed
- "".freeze.lstrip! # ok, nothing changed
-
+ lambda { "hello".freeze.lstrip! }.should raise_error(RuntimeError)
+ lambda { "".freeze.lstrip! }.should raise_error(RuntimeError)
lambda { " hello ".freeze.lstrip! }.should raise_error(RuntimeError)
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/modulo_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/modulo_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/modulo_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -216,7 +216,7 @@
end
end
- it "supports binary formats using %b" do
+ it "supports binary formats using %b for positive numbers" do
("%b" % 10).should == "1010"
("% b" % 10).should == " 1010"
("%1$b" % [10, 20]).should == "1010"
@@ -226,19 +226,38 @@
("%05b" % 10).should == "01010"
("%*b" % [10, 6]).should == " 110"
("%*b" % [-10, 6]).should == "110 "
-
- ("%b" % -5).should == "..1011"
- ("%0b" % -5).should == "1011"
("%.4b" % 2).should == "0010"
- ("%.1b" % -5).should == "1011"
- ("%.7b" % -5).should == "1111011"
- ("%.10b" % -5).should == "1111111011"
- ("% b" % -5).should == "-101"
- ("%+b" % -5).should == "-101"
- ("%b" % -(2 ** 64 + 5)).should ==
- "..101111111111111111111111111111111111111111111111111111111111111011"
end
+ ruby_version_is ""..."1.9" do
+ it "supports binary formats using %b for negative numbers" do
+ ("%b" % -5).should == "..1011"
+ ("%0b" % -5).should == "1011"
+ ("%.4b" % 2).should == "0010"
+ ("%.1b" % -5).should == "1011"
+ ("%.7b" % -5).should == "1111011"
+ ("%.10b" % -5).should == "1111111011"
+ ("% b" % -5).should == "-101"
+ ("%+b" % -5).should == "-101"
+ ("%b" % -(2 ** 64 + 5)).should ==
+ "..101111111111111111111111111111111111111111111111111111111111111011"
+ end
+ end
+
+ ruby_version_is "1.9" do
+ it "supports binary formats using %b for negative numbers" do
+ ("%b" % -5).should == "..1011"
+ ("%0b" % -5).should == "..1011"
+ ("%.1b" % -5).should == "..1011"
+ ("%.7b" % -5).should == "..11011"
+ ("%.10b" % -5).should == "..11111011"
+ ("% b" % -5).should == "-101"
+ ("%+b" % -5).should == "-101"
+ ("%b" % -(2 ** 64 + 5)).should ==
+ "..101111111111111111111111111111111111111111111111111111111111111011"
+ end
+ end
+
it "supports binary formats using %B with same behaviour as %b except for using 0B instead of 0b for #" do
("%B" % 10).should == ("%b" % 10)
("% B" % 10).should == ("% b" % 10)
@@ -261,19 +280,33 @@
("%#B" % 10).should == "0B1010"
end
- it "supports character formats using %c" do
- ("%c" % 10).should == "\n"
- ("%2$c" % [10, 11, 14]).should == "\v"
- ("%-4c" % 10).should == "\n "
- ("%*c" % [10, 3]).should == " \003"
- ("%c" % (256 + 42)).should == "*"
+ ruby_version_is ""..."1.9" do
+ it "supports character formats using %c" do
+ ("%c" % 10).should == "\n"
+ ("%2$c" % [10, 11, 14]).should == "\v"
+ ("%-4c" % 10).should == "\n "
+ ("%*c" % [10, 3]).should == " \003"
+ ("%c" % (256 + 42)).should == "*"
- lambda { "%c" % Object }.should raise_error(TypeError)
+ lambda { "%c" % Object }.should raise_error(TypeError)
+ end
+
+ it "uses argument % 256" do
+ ("%c" % [256 * 3 + 64]).should == ("%c" % 64)
+ ("%c" % -200).should == ("%c" % 56)
+ end
end
- it "uses argument % 256" do
- ("%c" % [256 * 3 + 64]).should == ("%c" % 64)
- ("%c" % -200).should == ("%c" % 56)
+ ruby_version_is "1.9" do
+ it "supports character formats using %c" do
+ ("%c" % 10).should == "\n"
+ ("%2$c" % [10, 11, 14]).should == "\v"
+ ("%-4c" % 10).should == "\n "
+ ("%*c" % [10, 3]).should == " \003"
+ ("%c" % 42).should == "*"
+
+ lambda { "%c" % Object }.should raise_error(TypeError)
+ end
end
ruby_version_is "1.8.6.278" do
@@ -316,12 +349,17 @@
("%*e" % [10, 9]).should == "9.000000e+00"
end
- not_compliant_on :rubinius, :jruby do
- it "supports float formats using %e, and downcases -Inf, Inf, and NaN" do
- ("%e" % 1e1020).should == "inf"
- ("%e" % -1e1020).should == "-inf"
- ("%e" % (0.0/0)).should == "nan"
- ("%e" % (-0e0/0)).should == "nan"
+ # TODO: If http://redmine.ruby-lang.org/issues/show/1566 is confirmed, we
+ # can guard the behaviour of capitalising Inf and NaN as a bug, and
+ # removed the compliance guards.
+ ruby_version_is ""..."1.9" do
+ not_compliant_on :rubinius, :jruby do
+ it "supports float formats using %e, and downcases -Inf, Inf, and NaN" do
+ ("%e" % 1e1020).should == "inf"
+ ("%e" % -1e1020).should == "-inf"
+ ("%e" % (0.0/0)).should == "nan"
+ ("%e" % (-0e0/0)).should == "nan"
+ end
end
end
@@ -329,6 +367,10 @@
# that cannot be expressed with any value in the set of real numbers. Upcasing
# or downcasing these identifiers for %e or %E, which refers to the case of the
# of the exponent identifier, is silly.
+
+ # TODO: If http://redmine.ruby-lang.org/issues/show/1566 is confirmed, we
+ # can guard the behaviour of capitalising Inf and NaN as a bug, and
+ # removed the compliance guards.
deviates_on :rubinius, :jruby do
it "supports float formats using %e, but Inf, -Inf, and NaN are not floats" do
("%e" % 1e1020).should == "Inf"
@@ -360,30 +402,58 @@
("%*E" % [10, 9]).should == "9.000000E+00"
end
+ # TODO: If http://redmine.ruby-lang.org/issues/show/1566 is confirmed, we
+ # can guard the behaviour of capitalising Inf and NaN as a bug, and
+ # removed the compliance guards.
not_compliant_on :rubinius, :jruby do
- it "supports float formats using %E, and upcases Inf, -Inf, and NaN" do
- ("%E" % 1e1020).should == "INF"
- ("%E" % -1e1020).should == "-INF"
- ("%-10E" % 1e1020).should == "INF "
- ("%+E" % 1e1020).should == "+INF"
- ("% E" % 1e1020).should == " INF"
- ("%E" % (0.0/0)).should == "NAN"
- ("%E" % (-0e0/0)).should == "NAN"
+ ruby_version_is ""..."1.9" do
+ it "supports float formats using %E, and upcases Inf, -Inf, and NaN" do
+ ("%E" % 1e1020).should == "INF"
+ ("%E" % -1e1020).should == "-INF"
+ ("%-10E" % 1e1020).should == "INF "
+ ("%+E" % 1e1020).should == "+INF"
+ ("% E" % 1e1020).should == " INF"
+ ("%E" % (0.0/0)).should == "NAN"
+ ("%E" % (-0e0/0)).should == "NAN"
+ end
end
+
+ # TODO: If http://redmine.ruby-lang.org/issues/show/1566 is confirmed, we
+ # can guard the behaviour of capitalising Inf and NaN as a bug, and
+ # removed the compliance guards.
+ ruby_version_is ""..."1.9" do
+ platform_is :darwin do
+ it "pads with zeros using %E with Inf, -Inf, and NaN" do
+ ("%010E" % -1e1020).should == "-000000INF"
+ ("%010E" % 1e1020).should == "0000000INF"
+ ("%010E" % (0.0/0)).should == "0000000NAN"
+ end
+ end
- platform_is :darwin do
- it "pads with zeros using %E with Inf, -Inf, and NaN" do
- ("%010E" % -1e1020).should == "-000000INF"
- ("%010E" % 1e1020).should == "0000000INF"
- ("%010E" % (0.0/0)).should == "0000000NAN"
+ platform_is_not :darwin do
+ it "pads with spaces for %E with Inf, -Inf, and NaN" do
+ ("%010E" % -1e1020).should == " -INF"
+ ("%010E" % 1e1020).should == " INF"
+ ("%010E" % (0.0/0)).should == " NAN"
+ end
end
end
+
+ ruby_version_is "1.9" do
+ platform_is :darwin do
+ it "pads with zeros using %E with Inf, -Inf, and NaN" do
+ ("%010E" % -1e1020).should == "-000000Inf"
+ ("%010E" % 1e1020).should == "0000000Inf"
+ ("%010E" % (0.0/0)).should == "0000000NaN"
+ end
+ end
- platform_is_not :darwin do
- it "pads with spaces for %E with Inf, -Inf, and NaN" do
- ("%010E" % -1e1020).should == " -INF"
- ("%010E" % 1e1020).should == " INF"
- ("%010E" % (0.0/0)).should == " NAN"
+ platform_is_not :darwin do
+ it "pads with spaces for %E with Inf, -Inf, and NaN" do
+ ("%010E" % -1e1020).should == " -Inf"
+ ("%010E" % 1e1020).should == " Inf"
+ ("%010E" % (0.0/0)).should == " NaN"
+ end
end
end
end
@@ -421,7 +491,7 @@
("%*G" % [10, 9]).should == " 9"
end
- it "supports octal formats using %o" do
+ it "supports octal formats using %o for positive numbers" do
("%o" % 10).should == "12"
("% o" % 10).should == " 12"
("%1$o" % [10, 20]).should == "12"
@@ -430,20 +500,40 @@
("%-9o" % 10).should == "12 "
("%05o" % 10).should == "00012"
("%*o" % [10, 6]).should == " 6"
+ end
- # These are incredibly wrong. -05 == -5, not 7177777...whatever
- ("%o" % -5).should == "..73"
- ("%0o" % -5).should == "73"
- ("%.4o" % 20).should == "0024"
- ("%.1o" % -5).should == "73"
- ("%.7o" % -5).should == "7777773"
- ("%.10o" % -5).should == "7777777773"
+ ruby_version_is ""..."1.9" do
+ it "supports octal formats using %o for negative numbers" do
+ # These are incredibly wrong. -05 == -5, not 7177777...whatever
+ ("%o" % -5).should == "..73"
+ ("%0o" % -5).should == "73"
+ ("%.4o" % 20).should == "0024"
+ ("%.1o" % -5).should == "73"
+ ("%.7o" % -5).should == "7777773"
+ ("%.10o" % -5).should == "7777777773"
- ("% o" % -26).should == "-32"
- ("%+o" % -26).should == "-32"
- ("%o" % -(2 ** 64 + 5)).should == "..75777777777777777777773"
+ ("% o" % -26).should == "-32"
+ ("%+o" % -26).should == "-32"
+ ("%o" % -(2 ** 64 + 5)).should == "..75777777777777777777773"
+ end
end
+ ruby_version_is "1.9" do
+ it "supports octal formats using %o for negative numbers" do
+ # These are incredibly wrong. -05 == -5, not 7177777...whatever
+ ("%o" % -5).should == "..73"
+ ("%0o" % -5).should == "..73"
+ ("%.4o" % 20).should == "0024"
+ ("%.1o" % -5).should == "..73"
+ ("%.7o" % -5).should == "..77773"
+ ("%.10o" % -5).should == "..77777773"
+
+ ("% o" % -26).should == "-32"
+ ("%+o" % -26).should == "-32"
+ ("%o" % -(2 ** 64 + 5)).should == "..75777777777777777777773"
+ end
+ end
+
it "supports inspect formats using %p" do
("%p" % 10).should == "10"
("%1$p" % [10, 5]).should == "10"
@@ -549,23 +639,32 @@
("%+u" % -26).should == "-26"
end
- not_compliant_on :rubinius do
- # This is the proper, compliant behavior of both JRuby, and
- # MRI 1.8.6 with patchlevel greater than 114.
- ruby_bug "http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/8418", "1.8.6.114" do
- it "supports negative bignums by prefixing the value with dots" do
- ("%u" % -(2 ** 64 + 5)).should == "..79228162495817593519834398715"
+ ruby_version_is ""..."1.9" do
+ not_compliant_on :rubinius do
+ # This is the proper, compliant behavior of both JRuby, and
+ # MRI 1.8.6 with patchlevel greater than 114.
+ ruby_bug "http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/8418", "1.8.6.114" do
+ it "supports negative bignums by prefixing the value with dots" do
+ ("%u" % -(2 ** 64 + 5)).should == "..79228162495817593519834398715"
+ end
end
end
+
+ deviates_on :rubinius do
+ it "does not support negative bignums" do
+ lambda { ("%u" % -(2 ** 64 + 5)) }.should raise_error(ArgumentError)
+ end
+ end
end
- deviates_on :rubinius do
- it "does not support negative bignums" do
- lambda { ("%u" % -(2 ** 64 + 5)) }.should raise_error(ArgumentError)
+ ruby_version_is "1.9" do
+ it "supports negative bignums with %u or %d" do
+ ("%u" % -(2 ** 64 + 5)).should == "-18446744073709551621"
+ ("%d" % -(2 ** 64 + 5)).should == "-18446744073709551621"
end
end
-
- it "supports hex formats using %x" do
+
+ it "supports hex formats using %x for positive numbers" do
("%x" % 10).should == "a"
("% x" % 10).should == " a"
("%1$x" % [10, 20]).should == "a"
@@ -574,20 +673,39 @@
("%-9x" % 10).should == "a "
("%05x" % 10).should == "0000a"
("%*x" % [10, 6]).should == " 6"
-
- ("%x" % -5).should == "..fb"
- ("%0x" % -5).should == "fb"
("%.4x" % 20).should == "0014"
- ("%.1x" % -5).should == "fb"
- ("%.7x" % -5).should == "ffffffb"
- ("%.10x" % -5).should == "fffffffffb"
- ("% x" % -26).should == "-1a"
- ("%+x" % -26).should == "-1a"
("%x" % 0xFFFFFFFF).should == "ffffffff"
- ("%x" % -(2 ** 64 + 5)).should == "..fefffffffffffffffb"
end
- it "supports hex formats using %X" do
+ ruby_version_is ""..."1.9" do
+ it "supports hex formats using %x for negative numbers" do
+ ("%x" % -5).should == "..fb"
+ ("%0x" % -5).should == "fb"
+ ("%.4x" % 20).should == "0014"
+ ("%.1x" % -5).should == "fb"
+ ("%.7x" % -5).should == "ffffffb"
+ ("%.10x" % -5).should == "fffffffffb"
+ ("% x" % -26).should == "-1a"
+ ("%+x" % -26).should == "-1a"
+ ("%x" % 0xFFFFFFFF).should == "ffffffff"
+ ("%x" % -(2 ** 64 + 5)).should == "..fefffffffffffffffb"
+ end
+ end
+
+ ruby_version_is "1.9" do
+ it "supports hex formats using %x for negative numbers" do
+ ("%x" % -5).should == "..fb"
+ ("%0x" % -5).should == "..fb"
+ ("%.1x" % -5).should == "..fb"
+ ("%.7x" % -5).should == "..ffffb"
+ ("%.10x" % -5).should == "..fffffffb"
+ ("% x" % -26).should == "-1a"
+ ("%+x" % -26).should == "-1a"
+ ("%x" % -(2 ** 64 + 5)).should == "..fefffffffffffffffb"
+ end
+ end
+
+ it "supports hex formats using %X for positive numbers" do
("%X" % 10).should == "A"
("% X" % 10).should == " A"
("%1$X" % [10, 20]).should == "A"
@@ -596,19 +714,37 @@
("%-9X" % 10).should == "A "
("%05X" % 10).should == "0000A"
("%*X" % [10, 6]).should == " 6"
-
- ("%X" % -5).should == "..FB"
- ("%0X" % -5).should == "FB"
- ("%.1X" % -5).should == "FB"
- ("%.7X" % -5).should == "FFFFFFB"
- ("%.10X" % -5).should == "FFFFFFFFFB"
- ("% X" % -26).should == "-1A"
- ("%+X" % -26).should == "-1A"
("%X" % 0xFFFFFFFF).should == "FFFFFFFF"
- ("%X" % -(2 ** 64 + 5)).should == "..FEFFFFFFFFFFFFFFFB"
end
+ ruby_version_is "" ... "1.9" do
+ it "supports hex formats using %X for negative numbers" do
+ ("%X" % -5).should == "..FB"
+ ("%0X" % -5).should == "FB"
+ ("%.1X" % -5).should == "FB"
+ ("%.7X" % -5).should == "FFFFFFB"
+ ("%.10X" % -5).should == "FFFFFFFFFB"
+ ("% X" % -26).should == "-1A"
+ ("%+X" % -26).should == "-1A"
+ ("%X" % 0xFFFFFFFF).should == "FFFFFFFF"
+ ("%X" % -(2 ** 64 + 5)).should == "..FEFFFFFFFFFFFFFFFB"
+ end
+ end
+
ruby_version_is "1.9" do
+ it "supports hex formats using %X for negative numbers" do
+ ("%X" % -5).should == "..FB"
+ ("%0X" % -5).should == "..FB"
+ ("%.1X" % -5).should == "..FB"
+ ("%.7X" % -5).should == "..FFFFB"
+ ("%.10X" % -5).should == "..FFFFFFFB"
+ ("% X" % -26).should == "-1A"
+ ("%+X" % -26).should == "-1A"
+ ("%X" % -(2 ** 64 + 5)).should == "..FEFFFFFFFFFFFFFFFB"
+ end
+ end
+
+ ruby_version_is "1.9" do
it 'formats zero without prefix using %#x' do
("%#x" % 0).should == "0"
end
@@ -633,7 +769,6 @@
it "behaves as if calling Kernel#Integer for #{format} argument, if it does not respond to #to_ary" do
(format % "10").should == (format % Kernel.Integer("10"))
- (format % nil).should == (format % Kernel.Integer(nil))
(format % "0x42").should == (format % Kernel.Integer("0x42"))
(format % "0b1101").should == (format % Kernel.Integer("0b1101"))
(format % "0b1101_0000").should == (format % Kernel.Integer("0b1101_0000"))
@@ -661,6 +796,17 @@
obj.should_receive(:to_int).and_return(6)
(format % obj).should == (format % 6)
end
+
+ # 1.9 raises a TypeError for Kernel.Integer(nil), so we version guard this
+ # case
+ ruby_version_is ""..."1.9" do
+ it "behaves as if calling Kernel#Integer(nil) for format argument, if it does not respond to #to_ary" do
+ %w(b d i o u x X).each do |f|
+ format = "%" + f
+ (format % nil).should == (format % Kernel.Integer(nil))
+ end
+ end
+ end
it "doesn't taint the result for #{format} when argument is tainted" do
(format % "5".taint).tainted?.should == false
Modified: MacRuby/branches/experimental/spec/frozen/core/string/replace_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/replace_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/replace_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -23,7 +23,7 @@
it "raises a TypeError if other can't be converted to string" do
lambda { "hello".replace(123) }.should raise_error(TypeError)
- lambda { "hello".replace(:test) }.should raise_error(TypeError)
+ lambda { "hello".replace([]) }.should raise_error(TypeError)
lambda { "hello".replace(mock('x')) }.should raise_error(TypeError)
end
@@ -36,13 +36,16 @@
lambda { a.replace("world") }.should raise_error(TypeError)
end
end
- ruby_version_is ""..."1.9" do
- it "raises a RuntimeError if self is frozen" do
- a = "hello".freeze
- a.replace(a) # ok, no change
- lambda { a.replace("") }.should raise_error(RuntimeError)
- lambda { a.replace("world") }.should raise_error(RuntimeError)
+ ruby_version_is "1.9" do
+ ruby_bug "[ruby-core:23666]", "1.9.2" do
+ it "raises a RuntimeError if self is frozen" do
+ a = "hello".freeze
+
+ lambda { a.replace(a) }.should raise_error(RuntimeError)
+ lambda { a.replace("") }.should raise_error(RuntimeError)
+ lambda { a.replace("world") }.should raise_error(RuntimeError)
+ end
end
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/reverse_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/reverse_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/reverse_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -32,10 +32,12 @@
end
ruby_version_is "1.9" do
- it "raises a RuntimeError if self is frozen" do
- "".freeze.reverse! # ok, no change
- lambda { "anna".freeze.reverse! }.should raise_error(RuntimeError)
- lambda { "hello".freeze.reverse! }.should raise_error(RuntimeError)
+ ruby_bug "[ruby-core:23666]", "1.9.2" do
+ it "raises a RuntimeError if self is frozen" do
+ lambda { "".freeze.reverse! }.should raise_error(RuntimeError)
+ lambda { "anna".freeze.reverse! }.should raise_error(RuntimeError)
+ lambda { "hello".freeze.reverse! }.should raise_error(RuntimeError)
+ end
end
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/rjust_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/rjust_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/rjust_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -62,8 +62,8 @@
end
it "raises a TypeError when padstr can't be converted" do
- lambda { "hello".rjust(20, :sym) }.should raise_error(TypeError)
- lambda { "hello".rjust(20, ?c) }.should raise_error(TypeError)
+ lambda { "hello".rjust(20, []) }.should raise_error(TypeError)
+ lambda { "hello".rjust(20, Object.new)}.should raise_error(TypeError)
lambda { "hello".rjust(20, mock('x')) }.should raise_error(TypeError)
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/rstrip_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/rstrip_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/rstrip_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -40,11 +40,12 @@
end
ruby_version_is "1.9" do
- it "raises a RuntimeError if self is frozen" do
- "hello".freeze.rstrip! # ok, nothing changed
- "".freeze.rstrip! # ok, nothing changed
-
- lambda { " hello ".freeze.rstrip! }.should raise_error(RuntimeError)
+ ruby_bug "[ruby-core:23666]", "1.9.2" do
+ it "raises a RuntimeError if self is frozen" do
+ lambda { "hello".freeze.rstrip! }.should raise_error(RuntimeError)
+ lambda { "".freeze.rstrip! }.should raise_error(RuntimeError)
+ lambda { " hello ".freeze.rstrip! }.should raise_error(RuntimeError)
+ end
end
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/slice_spec_disabled.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/slice_spec_disabled.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/slice_spec_disabled.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -51,7 +51,9 @@
ruby_version_is "1.9" do
it "raises a RuntimeError if self is frozen" do
- lambda { "hello".freeze.slice!(1) }.should raise_error(RuntimeError)
+ lambda { "hello".freeze.slice!(1) }.should raise_error(RuntimeError)
+ lambda { "hello".freeze.slice!(10) }.should raise_error(RuntimeError)
+ lambda { "".freeze.slice!(0) }.should raise_error(RuntimeError)
end
end
@@ -62,15 +64,6 @@
end
end
- ruby_version_is "1.9" do
- ruby_bug "#1551", "1.9.2" do
- it "doesn't raise a RuntimeError if self is frozen and idx is outside of self" do
- "hello".freeze.slice!(10).should be_nil
- "".freeze.slice!(0).should be_nil
- end
- end
- end
-
it "calls to_int on index" do
"hello".slice!(0.5).should == ?h
@@ -122,38 +115,16 @@
a.should == "hello"
end
- ruby_version_is ""..."1.9" do
- it "raises a TypeError if self is frozen" do
- lambda { "hello".freeze.slice!(1, 2) }.should raise_error(TypeError)
- end
-
- ruby_bug "#1551", "1.9.2" do
- it "doesn't raise a TypeError if self is frozen but the given position is out of self" do
- "hello".freeze.slice!(10, 3).should be_nil
- "hello".freeze.slice!(-10, 3).should be_nil
- end
-
- it "doesn't raise a TypeError if self is frozen but length is negative" do
- "hello".freeze.slice!(4, -3).should be_nil
- end
- end
- end
-
ruby_version_is "1.9" do
it "raises a RuntimeError if self is frozen" do
- lambda { "hello".freeze.slice!(1, 2) }.should raise_error(RuntimeError)
+ lambda { "hello".freeze.slice!(1, 2) }.should raise_error(RuntimeError)
+ lambda { "hello".freeze.slice!(10, 3) }.should raise_error(RuntimeError)
+ lambda { "hello".freeze.slice!(-10, 3)}.should raise_error(RuntimeError)
+ lambda { "hello".freeze.slice!(4, -3) }.should raise_error(RuntimeError)
+ lambda { "hello".freeze.slice!(10, 3) }.should raise_error(RuntimeError)
+ lambda { "hello".freeze.slice!(-10, 3)}.should raise_error(RuntimeError)
+ lambda { "hello".freeze.slice!(4, -3) }.should raise_error(RuntimeError)
end
-
- ruby_bug "#1551", "1.9.2" do
- it "doesn't raise a RuntimeError if self is frozen but the given position is out of self" do
- "hello".freeze.slice!(10, 3).should be_nil
- "hello".freeze.slice!(-10, 3).should be_nil
- end
-
- it "doesn't raise a RuntimeError if self is frozen but length is negative" do
- "hello".freeze.slice!(4, -3).should be_nil
- end
- end
end
it "calls to_int on idx and length" do
@@ -262,14 +233,9 @@
ruby_version_is "1.9" do
it "raises a RuntimeError if self is frozen" do
- lambda { "hello".freeze.slice!(1..3) }.should raise_error(RuntimeError)
+ lambda { "hello".freeze.slice!(1..3) }.should raise_error(RuntimeError)
+ lambda { "hello".freeze.slice!(10..20)}.should raise_error(RuntimeError)
end
-
- ruby_bug "#1551", "1.9.2" do
- it "doesn't raise a RuntimeError if self is frozen but the given range is out of self" do
- "hello".freeze.slice!(10..20).should == nil
- end
- end
end
end
@@ -332,24 +298,14 @@
it "raises a TypeError if self is frozen" do
lambda { "this is a string".freeze.slice!(/s.*t/) }.should raise_error(TypeError)
end
-
- ruby_bug "#1551", "1.9.2" do
- it "doesn't raise a TypeError if self is frozen but there is no match" do
- "this is a string".freeze.slice!(/zzz/).should == nil
- end
- end
end
ruby_version_is "1.9" do
it "raises a RuntimeError if self is frozen" do
lambda { "this is a string".freeze.slice!(/s.*t/) }.should raise_error(RuntimeError)
+ lambda { "this is a string".freeze.slice!(/zzz/) }.should raise_error(RuntimeError)
+ lambda { "this is a string".freeze.slice!(/zzz/) }.should raise_error(RuntimeError)
end
-
- ruby_bug "#1551", "1.9.2" do
- it "doesn't raise a RuntimeError if self is frozen but there is no match" do
- "this is a string".freeze.slice!(/zzz/).should == nil
- end
- end
end
end
@@ -442,18 +398,10 @@
ruby_version_is "1.9" do
it "raises a RuntimeError if self is frozen" do
- lambda { "this is a string".freeze.slice!(/s.*t/) }.should raise_error(RuntimeError)
+ lambda { "this is a string".freeze.slice!(/s.*t/) }.should raise_error(RuntimeError)
+ lambda { "this is a string".freeze.slice!(/zzz/, 0)}.should raise_error(RuntimeError)
+ lambda { "this is a string".freeze.slice!(/(.)/, 2)}.should raise_error(RuntimeError)
end
-
- ruby_bug "#1551", "1.9.2" do
- it "doesn't raise a RuntimeError if self is frozen but there is no match" do
- "this is a string".freeze.slice!(/zzz/, 0).should == nil
- end
-
- it "doesn't raise a RuntimeError if self is frozen but there is no capture for idx" do
- "this is a string".freeze.slice!(/(.)/, 2).should == nil
- end
- end
end
end
@@ -510,23 +458,13 @@
it "raises a TypeError if self is frozen" do
lambda { "hello hello".freeze.slice!('llo') }.should raise_error(TypeError)
end
-
- ruby_bug "#1551", "1.9." do
- it "doesn't raise a TypeError if self is frozen but self does not contain other" do
- "this is a string".freeze.slice!('zzz').should == nil
- end
- end
end
ruby_version_is "1.9" do
it "raises a RuntimeError if self is frozen" do
- lambda { "hello hello".freeze.slice!('llo') }.should raise_error(RuntimeError)
+ lambda { "hello hello".freeze.slice!('llo') }.should raise_error(RuntimeError)
+ lambda { "this is a string".freeze.slice!('zzz')}.should raise_error(RuntimeError)
+ lambda { "this is a string".freeze.slice!('zzz')}.should raise_error(RuntimeError)
end
-
- ruby_bug "#1551", "1.9" do
- it "doesn't raise a RuntimeError if self is frozen but self does not contain other" do
- "this is a string".freeze.slice!('zzz').should == nil
- end
- end
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/squeeze_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/squeeze_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/squeeze_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -66,8 +66,8 @@
end
it "raises a TypeError when one set arg can't be converted to a string" do
- lambda { "hello world".squeeze(?o) }.should raise_error(TypeError)
- lambda { "hello world".squeeze(:o) }.should raise_error(TypeError)
+ lambda { "hello world".squeeze([]) }.should raise_error(TypeError)
+ lambda { "hello world".squeeze(Object.new)}.should raise_error(TypeError)
lambda { "hello world".squeeze(mock('x')) }.should raise_error(TypeError)
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/strip_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/strip_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/strip_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -41,9 +41,8 @@
ruby_version_is "1.9" do
ruby_bug "#1552", "1.9.2" do
it "raises a RuntimeError if self is frozen" do
- "hello".freeze.strip! # ok, nothing changed
- "".freeze.strip! # ok, nothing changed
-
+ lambda {"hello".freeze.strip! }.should raise_error(RuntimeError)
+ lambda {"".freeze.strip! }.should raise_error(RuntimeError)
lambda { " hello ".freeze.strip! }.should raise_error(RuntimeError)
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/sub_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/sub_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/sub_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -157,9 +157,9 @@
end
it "raises a TypeError when pattern can't be converted to a string" do
- lambda { "hello".sub(:woot, "x") }.should raise_error(TypeError)
- lambda { "hello".sub(?e, "x") }.should raise_error(TypeError)
- lambda { "hello".sub(?e, nil) }.should raise_error(TypeError)
+ lambda { "hello".sub(:woot, "x") }.should raise_error(TypeError)
+ lambda { "hello".sub([], "x") }.should raise_error(TypeError)
+ lambda { "hello".sub(Object.new, nil)}.should raise_error(TypeError)
end
it "tries to convert replacement to a string using to_str" do
@@ -170,8 +170,8 @@
end
it "raises a TypeError when replacement can't be converted to a string" do
- lambda { "hello".sub(/[aeiou]/, :woot) }.should raise_error(TypeError)
- lambda { "hello".sub(/[aeiou]/, ?f) }.should raise_error(TypeError)
+ lambda { "hello".sub(/[aeiou]/, []) }.should raise_error(TypeError)
+ lambda { "hello".sub(/[aeiou]/, 99) }.should raise_error(TypeError)
end
it "returns subclass instances when called on a subclass" do
@@ -211,7 +211,7 @@
describe "String#sub with pattern and block" do
it "returns a copy of self with the first occurrences of pattern replaced with the block's return value" do
- "hi".sub(/./) { |s| s[0].to_s + ' ' }.should == "104 i"
+ "hi".sub(/./) { |s| s + ' ' }.should == "h i"
"hi!".sub(/(.)(.)/) { |*a| a.inspect }.should == '["hi"]!'
end
@@ -336,13 +336,15 @@
end
ruby_version_is "1.9" do
- it "raises a RuntimeError when self is frozen" do
- s = "hello"
- s.freeze
+ ruby_bug "[ruby-core:23666]", "1.9.2" do
+ it "raises a RuntimeError when self is frozen" do
+ s = "hello"
+ s.freeze
- s.sub!(/ROAR/, "x") # ok
- lambda { s.sub!(/e/, "e") }.should raise_error(RuntimeError)
- lambda { s.sub!(/[aeiou]/, '*') }.should raise_error(RuntimeError)
+ lambda { s.sub!(/ROAR/, "x") }.should raise_error(RuntimeError)
+ lambda { s.sub!(/e/, "e") }.should raise_error(RuntimeError)
+ lambda { s.sub!(/[aeiou]/, '*') }.should raise_error(RuntimeError)
+ end
end
end
end
Modified: MacRuby/branches/experimental/spec/frozen/core/string/to_i_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/to_i_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/to_i_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -2,23 +2,32 @@
require File.dirname(__FILE__) + '/fixtures/classes.rb'
describe "String#to_i" do
- it "ignores leading whitespaces" do
- [ " 123", " 123", "\r\n\r\n123", "\t\t123",
- "\r\n\t\n123", " \t\n\r\t 123"].each do |str|
- str.to_i.should == 123
+ # Ruby 1.9 doesn't allow underscores and spaces as part of a number
+ ruby_version_is ""..."1.9" do
+ it "ignores leading whitespaces" do
+ [ " 123", " 123", "\r\n\r\n123", "\t\t123",
+ "\r\n\t\n123", " \t\n\r\t 123"].each do |str|
+ str.to_i.should == 123
+ end
end
+
+ it "ignores leading underscores" do
+ "_123".to_i.should == 123
+ "__123".to_i.should == 123
+ "___123".to_i.should == 123
+ end
+
+ it "ignores underscores in between the digits" do
+ "1_2_3asdf".to_i.should == 123
+ end
+
+ it "ignores a leading mix of whitespaces and underscores" do
+ [ "_ _123", "_\t_123", "_\r\n_123" ].each do |str|
+ str.to_i.should == 123
+ end
+ end
end
-
- it "ignores leading underscores" do
- "_123".to_i.should == 123
- "__123".to_i.should == 123
- "___123".to_i.should == 123
- end
-
- it "ignores underscores in between the digits" do
- "1_2_3asdf".to_i.should == 123
- end
-
+
it "ignores subsequent invalid characters" do
"123asdf".to_i.should == 123
"123#123".to_i.should == 123
@@ -31,12 +40,6 @@
end
end
- it "ignores a leading mix of whitespaces and underscores" do
- [ "_ _123", "_\t_123", "_\r\n_123" ].each do |str|
- str.to_i.should == 123
- end
- end
-
it "interprets leading characters as a number in the given base" do
"100110010010".to_i(2).should == 0b100110010010
"100110201001".to_i(3).should == 186409
Modified: MacRuby/branches/experimental/spec/frozen/core/string/unpack_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/unpack_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/core/string/unpack_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -222,7 +222,11 @@
res[0].should be_close(96.0057601928711, @precision_small)
res[1].should be_close(2.23645357166299e-38, @precision_small)
- "\xFF\x80\x00\x00".unpack('g').to_s.should == "-Infinity"
+ # We expect -Infinity to be the result, i.e. a Float object named
+ # -Infinity. There doesn't seem to be any way to declare this
+ # explicitly, so we generate it by summing the maximum Float value and
+ # inverting the result...
+ "\xFF\x80\x00\x00".unpack('g')[0].should == -(Float::MAX + Float::MAX)
"\x01\x62\xEE\x42".unpack('e-7e')[0].should be_close(
119.191413879395, @precision_small)
"\x00\x00\x00\x00".unpack('f5').should == [0.0, nil, nil, nil, nil]
Modified: MacRuby/branches/experimental/spec/frozen/library/resolv/get_address_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/library/resolv/get_address_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/library/resolv/get_address_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -15,7 +15,7 @@
}.should_not raise_error(Resolv::ResolvError)
lambda {
- address = Resolv.getaddress("should.raise.error")
+ address = Resolv.getaddress("should.raise.error.")
}.should raise_error(Resolv::ResolvError)
end
Modified: MacRuby/branches/experimental/spec/frozen/library/set/divide_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/library/set/divide_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/library/set/divide_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -29,6 +29,6 @@
it "yields each two Object to the block" do
ret = []
Set[1, 2].divide { |x, y| ret << [x, y] }
- ret.should == [[1, 1], [1, 2], [2, 1], [2, 2]]
+ ret.sort.should == [[1, 1], [1, 2], [2, 1], [2, 2]]
end
end
Modified: MacRuby/branches/experimental/spec/frozen/library/socket/ipsocket/getaddress_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/library/socket/ipsocket/getaddress_spec.rb 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/library/socket/ipsocket/getaddress_spec.rb 2009-06-04 23:20:47 UTC (rev 1728)
@@ -14,7 +14,7 @@
end
it "raises an error on unknown hostnames" do
- lambda { IPSocket.getaddress("foobard") }.should raise_error(SocketError)
+ lambda { IPSocket.getaddress("foobard.") }.should raise_error(SocketError)
end
end
Modified: MacRuby/branches/experimental/spec/frozen/ruby.1.9.mspec
===================================================================
--- MacRuby/branches/experimental/spec/frozen/ruby.1.9.mspec 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/ruby.1.9.mspec 2009-06-04 23:20:47 UTC (rev 1728)
@@ -70,6 +70,8 @@
# [/_spec.rb$/, '_tags.txt']
# ]
+ set :backtrace_filter, /mspec\//
+
set :tags_patterns, [
[%r(language/), 'tags/macruby/language/'],
[%r(core/), 'tags/macruby/core/'],
Copied: MacRuby/branches/experimental/spec/frozen/ruby.1.9.mspec.orig (from rev 1727, MacRuby/branches/experimental/spec/frozen/ruby.1.9.mspec)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/ruby.1.9.mspec.orig (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/ruby.1.9.mspec.orig 2009-06-04 23:20:47 UTC (rev 1728)
@@ -0,0 +1,80 @@
+# Configuration file for Ruby 1.9-compatible Ruby implementations.
+#
+# Unless you passed to --config (or -B) to MSpec, MSpec will automatically
+# use this config file if the Ruby interpreter with which MSpec advertises
+# itself with RUBY_VERSION =~ /1.9/
+
+class MSpecScript
+ # Language features specs
+ set :language, [ 'language' ]
+
+ # Core library specs
+ set :core, [
+ 'core',
+
+ '^core/continuation'
+ ]
+
+ # Standard library specs
+ set :library, [
+ 'library',
+
+ # obsolete libraries
+ '^library/cgi-lib',
+ '^library/date2',
+ '^library/enumerator',
+ '^library/eregex',
+ '^library/finalize',
+ '^library/ftools',
+ '^library/generator',
+ '^library/getopts',
+ '^library/importenv',
+ '^library/jcode',
+ '^library/mailread',
+ '^library/parsearg',
+ '^library/parsedate',
+ '^library/ping',
+ '^library/readbytes',
+ '^library/rubyunit',
+ '^library/runit',
+ '^library/soap',
+ '^library/wsdl',
+ '^library/xsd',
+ '^library/Win32API',
+
+ '^library/test/unit/collector',
+ '^library/test/unit/ui',
+ '^library/test/unit/util',
+
+ '^library/dl', # reimplemented and API changed
+ ]
+
+ # An ordered list of the directories containing specs to run
+ set :files, get(:language) + get(:core) + get(:library)
+
+ # This set of files is run by mspec ci
+ set :ci_files, get(:files)
+
+ # The default implementation to run the specs.
+ # TODO: this needs to be more sophisticated since the
+ # executable is not consistently named.
+ set :target, 'ruby1.9'
+
+ # MacRuby TODO: For now we run the macruby tags.
+ #
+ # set :tags_patterns, [
+ # [%r(language/), 'tags/1.9/language/'],
+ # [%r(core/), 'tags/1.9/core/'],
+ # [%r(command_line/), 'tags/1.9/command_line/'],
+ # [%r(library/), 'tags/1.9/library/'],
+ # [/_spec.rb$/, '_tags.txt']
+ # ]
+
+ set :tags_patterns, [
+ [%r(language/), 'tags/macruby/language/'],
+ [%r(core/), 'tags/macruby/core/'],
+ [%r(command_line/), 'tags/macruby/command_line/'],
+ [%r(library/), 'tags/macruby/library/'],
+ [/_spec.rb$/, '_tags.txt']
+ ]
+end
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/delete_if_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/delete_if_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/hash/delete_if_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,4 +0,0 @@
-fails:Hash#delete_if processes entries with the same order as each()
-fails:Hash#delete_if raises a TypeError if called on a frozen instance
-fails:Hash#delete_if returns an Enumerator if called on a non-empty hash without a block
-fails:Hash#delete_if returns an Enumerator if called on an empty hash without a block
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/matchdata/to_a_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/matchdata/to_a_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/matchdata/to_a_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +0,0 @@
-critical:MatchData#to_a returns an array of matches
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/chop_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/chop_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/chop_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,2 +0,0 @@
-fails:String#chop returns a new string with the last character removed
-fails:String#chop! raises a TypeError when self is frozen
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/count_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/count_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/count_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +0,0 @@
-fails:String#count raises a TypeError when a set arg can't be converted to a string
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/delete_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/delete_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/delete_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,2 +0,0 @@
-fails:String#delete! raises a TypeError when self is frozen
-fails:String#delete raises a TypeError when one set arg can't be converted to a string
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/downcase_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/downcase_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/downcase_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +0,0 @@
-fails:String#downcase! raises a TypeError when self is frozen
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/dump_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/dump_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/dump_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,2 +0,0 @@
-fails:String#dump ignores the $KCODE setting
-fails:String#dump returns a string with nonprinting charaters replaced by escaped-numeric notation
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/each_line_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/each_line_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/each_line_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,2 +0,0 @@
-fails:String#each_line raises a RuntimeError if the string is modified while substituting
-fails:String#each_line raises a TypeError when the separator can't be converted to a string
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/each_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/each_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/each_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,10 +0,0 @@
-fails:String#each splits self using the supplied record separator and passes each substring to the block
-fails:String#each taints substrings that are passed to the block if self is tainted
-fails:String#each passes self as a whole to the block if the separator is nil
-fails:String#each appends multiple successive newlines together when the separator is an empty string
-fails:String#each uses $/ as the separator when none is given
-fails:String#each yields subclass instances for subclasses
-fails:String#each returns self
-fails:String#each tries to convert the separator to a string using to_str
-fails:String#each raises a RuntimeError if the string is modified while substituting
-fails:String#each raises a TypeError when the separator can't be converted to a string
Modified: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/element_set_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/element_set_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/element_set_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,8 +1,2 @@
-fails:String#[]= with index sets the code of the character at idx to char modulo 256
fails:String#[]= with index raises an IndexError without changing self if idx is outside of self
-fails:String#[]= with index sets the code to char % 256
-fails:String#[]= with index raises a TypeError when self is frozen
fails:String#[]= with String raises an IndexError without changing self if idx is outside of self
-fails:String#[]= with String raises a TypeError when self is frozen
-fails:String#[]= with String raises a TypeError if other_str can't be converted to a String
-fails:String#[]= with index, count raises a TypeError if other_str is a type other than String
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/include_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/include_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/include_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,3 +0,0 @@
-fails:String#include? with Fixnum returns true if self contains the given char
-fails:String#include? with Fixnum uses fixnum % 256
-fails:String#include? with String raises a TypeError if other can't be converted to string
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/insert_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/insert_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/insert_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,2 +0,0 @@
-fails:String#insert with index, other raises a TypeError if other can't be converted to string
-fails:String#insert with index, other raises a TypeError if self is frozen
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/inspect_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/inspect_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/inspect_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,3 +0,0 @@
-fails:String#inspect produces different output based on $KCODE
-fails:String#inspect can handle malformed UTF-8 string when $KCODE is UTF-8
-fails:String#inspect returns a string with nonprinting charaters replaced by escaped-numeric notation
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/intern_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/intern_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/intern_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +0,0 @@
-fails:String#intern raises an ArgumentError when self can't be converted to symbol
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/ljust_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/ljust_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/ljust_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +0,0 @@
-fails:String#ljust with length, padding raises a TypeError when padstr can't be converted
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/lstrip_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/lstrip_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/lstrip_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +0,0 @@
-fails:String#lstrip! raises a TypeError if self is frozen
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/modulo_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/modulo_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/modulo_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,18 +0,0 @@
-fails:String#% supports binary formats using %b
-fails:String#% supports character formats using %c
-fails:String#% uses argument % 256
-fails:String#% supports float formats using %e, and downcases -Inf, Inf, and NaN
-fails:String#% supports float formats using %E, and upcases Inf, -Inf, and NaN
-fails:String#% pads with zeros using %E with Inf, -Inf, and NaN
-fails:String#% supports octal formats using %o
-fails:String#% supports unsigned formats using %u
-fails:String#% supports hex formats using %x
-fails:String#% supports hex formats using %X
-fails:String#% behaves as if calling Kernel#Integer for %b argument, if it does not respond to #to_ary
-fails:String#% behaves as if calling Kernel#Integer for %d argument, if it does not respond to #to_ary
-fails:String#% behaves as if calling Kernel#Integer for %i argument, if it does not respond to #to_ary
-fails:String#% behaves as if calling Kernel#Integer for %o argument, if it does not respond to #to_ary
-fails:String#% behaves as if calling Kernel#Integer for %u argument, if it does not respond to #to_ary
-fails:String#% behaves as if calling Kernel#Integer for %x argument, if it does not respond to #to_ary
-fails:String#% behaves as if calling Kernel#Integer for %X argument, if it does not respond to #to_ary
-fails:String#% supports negative bignums by prefixing the value with dots
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/next_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/next_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/next_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +0,0 @@
-fails:String#next! raises a TypeError if self is frozen
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/replace_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/replace_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/replace_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,2 +0,0 @@
-fails:String#replace raises a TypeError if self is frozen
-fails:String#replace raises a TypeError if other can't be converted to string
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/reverse_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/reverse_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/reverse_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +0,0 @@
-fails:String#reverse! raises a TypeError if self is frozen
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/rjust_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/rjust_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/rjust_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +0,0 @@
-fails:String#rjust with length, padding raises a TypeError when padstr can't be converted
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/rstrip_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/rstrip_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/rstrip_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +0,0 @@
-fails:String#rstrip! raises a TypeError if self is frozen
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/squeeze_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/squeeze_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/squeeze_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +0,0 @@
-fails:String#squeeze raises a TypeError when one set arg can't be converted to a string
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/strip_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/strip_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/strip_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +0,0 @@
-fails:String#strip! raises a TypeError if self is frozen
Modified: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/sub_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/sub_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/sub_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,5 +1 @@
-fails:String#sub with pattern, replacement raises a TypeError when pattern can't be converted to a string
-fails:String#sub with pattern, replacement raises a TypeError when replacement can't be converted to a string
-fails:String#sub with pattern and block returns a copy of self with the first occurrences of pattern replaced with the block's return value
fails:String#sub with pattern and block restores $~ after leaving the block
-fails:String#sub! with pattern, replacement raises a TypeError when self is frozen
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/succ_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/succ_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/succ_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +0,0 @@
-fails:String#succ! raises a TypeError if self is frozen
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/swapcase_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/swapcase_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/swapcase_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +0,0 @@
-fails:String#swapcase! raises a TypeError when self is frozen
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/to_i_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/to_i_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/to_i_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,2 +0,0 @@
-fails:String#to_i ignores leading underscores
-fails:String#to_i ignores a leading mix of whitespaces and underscores
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/tr_s_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/tr_s_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/tr_s_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +0,0 @@
-fails:String#tr_s! raises a TypeError if self is frozen
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/tr_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/tr_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/tr_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +0,0 @@
-fails:String#tr! raises a TypeError if self is frozen
Deleted: MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/unpack_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/unpack_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/1.9/core/string/unpack_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +0,0 @@
-fails:String#unpack with 'DdEeFfGg' directives returns an array by decoding self in little-endian order according to the format string
Modified: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/concat_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/concat_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/concat_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,4 +1,5 @@
fails:Array#concat is not infected by the other
fails:Array#concat keeps untrusted status
fails:Array#concat is not infected untrustedness by the other
-fails:Array#concat keeps the untrusted status of elements
\ No newline at end of file
+fails:Array#concat keeps the untrusted status of elements
+fails:Array#concat raises a RuntimeError when Array is frozen and modification occurs
Modified: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/flatten_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/flatten_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/flatten_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +1,2 @@
fails:Array#flatten! returns nil when the level of recursion is 0
+fails:Array#flatten! raises a RuntimeError on frozen arrays
Modified: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/initialize_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/initialize_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/initialize_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -3,3 +3,4 @@
fails:Array#initialize raises a RuntimeError on frozen arrays even if the array would not be modified
fails:Array#initialize with no arguments makes the array empty
fails:Array#initialize with (size, object=nil) sets the array to the values returned by the block before break is executed
+fails:Array#initialize raises a RuntimeError on frozen arrays
Modified: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/insert_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/insert_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/insert_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +1,2 @@
fails:Array#insert inserts objects before the element at index for non-negative index
+fails:Array#insert raises a RuntimeError on frozen arrays
Modified: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/push_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/push_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/push_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,2 +1,3 @@
fails:Array#push raises a TypeError on a frozen array if modification takes place
fails:Array#push Raise a RuntimeError on a frozen array if no modification is made too
+fails:Array#push raises a RuntimeError on a frozen array
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/unshift_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/unshift_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/array/unshift_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -0,0 +1 @@
+fails:Array#unshift raises a RuntimeError on a frozen array
Modified: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/hash/initialize_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/hash/initialize_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/hash/initialize_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,2 +1,3 @@
fails:Hash#initialize is private
fails:Hash#initialize raises a TypeError if called on a frozen instance
+fails:Hash#initialize raises a RuntimeError if called on a frozen instance
Modified: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/chop_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/chop_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/chop_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,3 +1,4 @@
fails:String#chop returns a new string with the last character removed
fails:String#chop returns subclass instances when called on a subclass
fails:String#chop! raises a TypeError when self is frozen
+fails:String#chop! raises a RuntimeError when self is frozen
Modified: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/gsub_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/gsub_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/gsub_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -12,3 +12,5 @@
fails:String#gsub! with pattern and replacement raises a TypeError when self is frozen
fails:String#gsub! with pattern and block taints self if block's result is tainted
fails:String#gsub! with pattern and block untrusts self if block's result is untrusted
+fails:String#gsub! with pattern and replacement raises a RuntimeError when self is frozen
+fails:String#gsub! with pattern and block raises a RuntimeError when self is frozen
\ No newline at end of file
Modified: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/modulo_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/modulo_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/modulo_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -54,4 +54,14 @@
fails:String#% behaves as if calling Kernel#Float for %G arguments, when the passed argument does not respond to #to_ary
fails:String#% calls #to_int on argument for %c formats, if the argument does not respond to #to_ary
fails:String#% calls to_int on width star and precision star tokens
-fails:String#% raises an error if NULL or \n appear anywhere else in the format string
\ No newline at end of file
+fails:String#% raises an error if NULL or \n appear anywhere else in the format string
+fails:String#% supports binary formats using %b for positive numbers
+fails:String#% supports binary formats using %b for negative numbers
+fails:String#% pads with zeros using %E with Inf, -Inf, and NaN
+fails:String#% supports octal formats using %o for positive numbers
+fails:String#% supports octal formats using %o for negative numbers
+fails:String#% supports negative bignums with %u or %d
+fails:String#% supports hex formats using %x for positive numbers
+fails:String#% supports hex formats using %x for negative numbers
+fails:String#% supports hex formats using %X for positive numbers
+fails:String#% supports hex formats using %X for negative numbers
\ No newline at end of file
Modified: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/replace_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/replace_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/replace_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1,3 +1,4 @@
critical:String#replace tries to convert other to string using to_str
critical:String#replace raises a TypeError if other can't be converted to string
-fails:String#replace raises a TypeError if self is frozen
\ No newline at end of file
+fails:String#replace raises a TypeError if self is frozen
+fails:String#replace raises a RuntimeError if self is frozen
Modified: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/sub_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/sub_tags.txt 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/sub_tags.txt 2009-06-04 23:20:47 UTC (rev 1728)
@@ -10,3 +10,4 @@
fails:String#sub! with pattern, replacement raises a TypeError when self is frozen
fails:String#sub! with pattern and block taints self if block's result is tainted
fails:String#sub! with pattern and block raises a RuntimeError if the string is modified while substituting
+fails:String#sub! with pattern, replacement raises a RuntimeError when self is frozen
Modified: MacRuby/branches/experimental/spec/frozen/upstream
===================================================================
--- MacRuby/branches/experimental/spec/frozen/upstream 2009-06-04 22:59:28 UTC (rev 1727)
+++ MacRuby/branches/experimental/spec/frozen/upstream 2009-06-04 23:20:47 UTC (rev 1728)
@@ -1 +1 @@
-34f2569f0b4fcf2a61b0ea5923fb42de26484642
\ No newline at end of file
+93497d7fc3909a8a6c892f1a79a0ca6a1239d247
\ No newline at end of file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090604/cee68503/attachment-0001.html>
More information about the macruby-changes
mailing list