[macruby-changes] [1685] MacRuby/branches/experimental
source_changes at macosforge.org
source_changes at macosforge.org
Sun May 31 16:34:50 PDT 2009
Revision: 1685
http://trac.macosforge.org/projects/ruby/changeset/1685
Author: eloy.de.enige at gmail.com
Date: 2009-05-31 16:34:49 -0700 (Sun, 31 May 2009)
Log Message:
-----------
Tagged critical and failing examples of String spec and added String to spec:ci. Had to disable quite a few specs, but a lot with regards to MSpec not loading the shared behaviour and syntax errors.
Modified Paths:
--------------
MacRuby/branches/experimental/rakelib/spec.rake
Added Paths:
-----------
MacRuby/branches/experimental/spec/frozen/core/string/append_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/ascii_only_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/bytesize_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/capitalize_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/concat_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/downcase_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/dump_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/each_byte_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/element_reference_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/eql_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/equal_value_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/getbyte_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/inspect_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/intern_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/next_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/slice_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/succ_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/swapcase_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/to_s_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/to_str_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/to_sym_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/upcase_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/core/string/valid_encoding_spec_disabled.rb
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/casecmp_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/center_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/chomp_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/chop_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/comparison_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/count_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/crypt_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/delete_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/each_char_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/each_line_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/element_set_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/empty_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/end_with_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/entries_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/gsub_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/include_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/index_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/initialize_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/insert_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/ljust_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/lstrip_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/match_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/modulo_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/multiply_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/partition_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/plus_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/replace_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/reverse_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/rindex_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/rjust_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/rpartition_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/rstrip_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/scan_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/size_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/slice_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/split_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/squeeze_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/start_with_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/strip_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/sub_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/to_a_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/to_i_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/tr_s_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/tr_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/unpack_tags.txt
MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/upto_tags.txt
Removed Paths:
-------------
MacRuby/branches/experimental/spec/frozen/core/string/append_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/ascii_only_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/bytesize_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/capitalize_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/concat_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/downcase_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/dump_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/each_byte_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/element_reference_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/eql_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/equal_value_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/getbyte_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/inspect_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/intern_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/next_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/slice_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/succ_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/swapcase_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/to_s_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/to_str_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/to_sym_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/upcase_spec.rb
MacRuby/branches/experimental/spec/frozen/core/string/valid_encoding_spec.rb
Modified: MacRuby/branches/experimental/rakelib/spec.rake
===================================================================
--- MacRuby/branches/experimental/rakelib/spec.rake 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/rakelib/spec.rake 2009-05-31 23:34:49 UTC (rev 1685)
@@ -74,6 +74,7 @@
spec/frozen/core/object
spec/frozen/core/range
spec/frozen/core/regexp
+ spec/frozen/core/string
spec/frozen/core/symbol
spec/frozen/core/true
spec/frozen/core/unboundmethod
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/append_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/append_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/append_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,11 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-require File.dirname(__FILE__) + '/shared/concat.rb'
-
-describe "String#<<" do
- it_behaves_like :string_concat, :<<
-end
-
-describe "String#<< with Fixnum" do
- it_behaves_like :string_concat_fixnum, :<<
-end
Copied: MacRuby/branches/experimental/spec/frozen/core/string/append_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/append_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/append_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/append_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,11 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+require File.dirname(__FILE__) + '/shared/concat.rb'
+
+describe "String#<<" do
+ it_behaves_like :string_concat, :<<
+end
+
+describe "String#<< with Fixnum" do
+ it_behaves_like :string_concat_fixnum, :<<
+end
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/ascii_only_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/ascii_only_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/ascii_only_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,64 +0,0 @@
-# -*- encoding: utf-8 -*-
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-
-ruby_version_is '1.9' do
- describe "String#ascii_only?" do
- it "needs to be reviewed for spec completeness"
-
- it "returns true if the String contains only ASCII characters" do
- "hello".ascii_only?.should be_true
- end
-
- it "returns true if the String contains only ASCII characters
- and is encoded as ASCII" do
- "hello".force_encoding('ASCII').ascii_only?.should be_true
- "hello".encode("ASCII").ascii_only?.should be_true
- end
-
- it "returns true if the String contains only ASCII characters
- and is encoded as UTF-8" do
- "hello".force_encoding('UTF-8').ascii_only?.should be_true
- "hello".encode('UTF-8').ascii_only?.should be_true
- end
-
- it "returns false if the String contains only non-ASCII characters" do
- "\u{6666}".ascii_only?.should be_false
- end
-
- it "returns false if the String contains only non-ASCII characters
- and is encoded as UTF-8" do
- "\u{6666}".force_encoding('UTF-8').ascii_only?.should be_false
- "\u{6666}".encode('UTF-8').ascii_only?.should be_false
- end
-
- it "returns false if the String contains only non-ASCII characters
- and is encoded as ASCII" do
- "\u{6666}".force_encoding('ASCII').ascii_only?.should be_false
- end
-
- it "returns false if the String contains ASCII and non-ASCII characters" do
- "hello, \u{6666}".ascii_only?.should be_false
- end
-
- it "returns false if the String contains ASCII and non-ASCII characters
- and is encoded as ASCII" do
- "hello, \u{6666}".force_encoding('ASCII').ascii_only?.should be_false
- end
-
- it "returns false if the String contains ASCII and non-ASCII characters
- and is encoded as UTF-8" do
- "hello, \u{6666}".encode('UTF-8').ascii_only?.should be_false
- "hello, \u{6666}".force_encoding('UTF-8').ascii_only?.should be_false
- end
-
- it "accepts no arguments" do
- lambda { "Glark".ascii_only?('?') }.should raise_error(ArgumentError)
- end
-
- it "returns true for the empty String" do
- ''.ascii_only?.should be_true
- ''.encode('UTF-8').ascii_only?.should be_true
- end
- end
-end
Copied: MacRuby/branches/experimental/spec/frozen/core/string/ascii_only_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/ascii_only_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/ascii_only_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/ascii_only_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,64 @@
+# -*- encoding: utf-8 -*-
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+
+ruby_version_is '1.9' do
+ describe "String#ascii_only?" do
+ it "needs to be reviewed for spec completeness"
+
+ it "returns true if the String contains only ASCII characters" do
+ "hello".ascii_only?.should be_true
+ end
+
+ it "returns true if the String contains only ASCII characters
+ and is encoded as ASCII" do
+ "hello".force_encoding('ASCII').ascii_only?.should be_true
+ "hello".encode("ASCII").ascii_only?.should be_true
+ end
+
+ it "returns true if the String contains only ASCII characters
+ and is encoded as UTF-8" do
+ "hello".force_encoding('UTF-8').ascii_only?.should be_true
+ "hello".encode('UTF-8').ascii_only?.should be_true
+ end
+
+ it "returns false if the String contains only non-ASCII characters" do
+ "\u{6666}".ascii_only?.should be_false
+ end
+
+ it "returns false if the String contains only non-ASCII characters
+ and is encoded as UTF-8" do
+ "\u{6666}".force_encoding('UTF-8').ascii_only?.should be_false
+ "\u{6666}".encode('UTF-8').ascii_only?.should be_false
+ end
+
+ it "returns false if the String contains only non-ASCII characters
+ and is encoded as ASCII" do
+ "\u{6666}".force_encoding('ASCII').ascii_only?.should be_false
+ end
+
+ it "returns false if the String contains ASCII and non-ASCII characters" do
+ "hello, \u{6666}".ascii_only?.should be_false
+ end
+
+ it "returns false if the String contains ASCII and non-ASCII characters
+ and is encoded as ASCII" do
+ "hello, \u{6666}".force_encoding('ASCII').ascii_only?.should be_false
+ end
+
+ it "returns false if the String contains ASCII and non-ASCII characters
+ and is encoded as UTF-8" do
+ "hello, \u{6666}".encode('UTF-8').ascii_only?.should be_false
+ "hello, \u{6666}".force_encoding('UTF-8').ascii_only?.should be_false
+ end
+
+ it "accepts no arguments" do
+ lambda { "Glark".ascii_only?('?') }.should raise_error(ArgumentError)
+ end
+
+ it "returns true for the empty String" do
+ ''.ascii_only?.should be_true
+ ''.encode('UTF-8').ascii_only?.should be_true
+ end
+ end
+end
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/bytesize_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/bytesize_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/bytesize_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,37 +0,0 @@
-# -*- encoding: utf-8 -*-
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-
-ruby_version_is "1.9" do
- describe "#String#bytesize" do
- it "needs to be reviewed for spec completeness"
-
- it "returns the length of self in bytes" do
- "hello".bytesize.should == 5
- " ".bytesize.should == 1
- end
-
- it "works with strings containing single UTF-8 characters" do
- "\u{6666}".bytesize.should == 3
- end
-
- it "works with psuedo-ASCII strings containing single UTF-8 characters" do
- "\u{6666}".force_encoding('ASCII').bytesize.should == 3
- end
-
- it "works with strings containing UTF-8 characters" do
- "c \u{6666}".force_encoding('UTF-8').bytesize.should == 5
- "c \u{6666}".bytesize.should == 5
- end
-
- it "works with psuedo-ASCII strings containing UTF-8 characters" do
- "c \u{6666}".force_encoding('ASCII').bytesize.should == 5
- end
-
- it "returns 0 for the empty string" do
- "".bytesize.should == 0
- "".force_encoding('ASCII').bytesize.should == 0
- "".force_encoding('UTF-8').bytesize.should == 0
- end
- end
-end
Copied: MacRuby/branches/experimental/spec/frozen/core/string/bytesize_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/bytesize_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/bytesize_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/bytesize_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,37 @@
+# -*- encoding: utf-8 -*-
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+
+ruby_version_is "1.9" do
+ describe "#String#bytesize" do
+ it "needs to be reviewed for spec completeness"
+
+ it "returns the length of self in bytes" do
+ "hello".bytesize.should == 5
+ " ".bytesize.should == 1
+ end
+
+ it "works with strings containing single UTF-8 characters" do
+ "\u{6666}".bytesize.should == 3
+ end
+
+ it "works with psuedo-ASCII strings containing single UTF-8 characters" do
+ "\u{6666}".force_encoding('ASCII').bytesize.should == 3
+ end
+
+ it "works with strings containing UTF-8 characters" do
+ "c \u{6666}".force_encoding('UTF-8').bytesize.should == 5
+ "c \u{6666}".bytesize.should == 5
+ end
+
+ it "works with psuedo-ASCII strings containing UTF-8 characters" do
+ "c \u{6666}".force_encoding('ASCII').bytesize.should == 5
+ end
+
+ it "returns 0 for the empty string" do
+ "".bytesize.should == 0
+ "".force_encoding('ASCII').bytesize.should == 0
+ "".force_encoding('UTF-8').bytesize.should == 0
+ end
+ end
+end
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/capitalize_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/capitalize_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/capitalize_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,54 +0,0 @@
-# -*- encoding: utf-8 -*-
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-
-describe "String#capitalize" do
- it "returns a copy of self with the first character converted to uppercase and the remainder to lowercase" do
- "".capitalize.should == ""
- "h".capitalize.should == "H"
- "H".capitalize.should == "H"
- "hello".capitalize.should == "Hello"
- "HELLO".capitalize.should == "Hello"
- "123ABC".capitalize.should == "123abc"
- end
-
- it "taints resulting string when self is tainted" do
- "".taint.capitalize.tainted?.should == true
- "hello".taint.capitalize.tainted?.should == true
- end
-
- it "is locale insensitive (only upcases a-z and only downcases A-Z)" do
- "ÄÖÜ".capitalize.should == "ÄÖÜ"
- "ärger".capitalize.should == "ärger"
- "BÄR".capitalize.should == "BÄr"
- end
-
- it "returns subclass instances when called on a subclass" do
- StringSpecs::MyString.new("hello").capitalize.class.should == StringSpecs::MyString
- StringSpecs::MyString.new("Hello").capitalize.class.should == StringSpecs::MyString
- end
-end
-
-describe "String#capitalize!" do
- it "capitalizes self in place" do
- a = "hello"
- a.capitalize!.should equal(a)
- a.should == "Hello"
- end
-
- it "returns nil when no changes are made" do
- a = "Hello"
- a.capitalize!.should == nil
- a.should == "Hello"
-
- "".capitalize!.should == nil
- "H".capitalize!.should == nil
- end
-
- it "raises a TypeError when self is frozen" do
- ["", "Hello", "hello"].each do |a|
- a.freeze
- lambda { a.capitalize! }.should raise_error(TypeError)
- end
- end
-end
Copied: MacRuby/branches/experimental/spec/frozen/core/string/capitalize_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/capitalize_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/capitalize_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/capitalize_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,54 @@
+# -*- encoding: utf-8 -*-
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+
+describe "String#capitalize" do
+ it "returns a copy of self with the first character converted to uppercase and the remainder to lowercase" do
+ "".capitalize.should == ""
+ "h".capitalize.should == "H"
+ "H".capitalize.should == "H"
+ "hello".capitalize.should == "Hello"
+ "HELLO".capitalize.should == "Hello"
+ "123ABC".capitalize.should == "123abc"
+ end
+
+ it "taints resulting string when self is tainted" do
+ "".taint.capitalize.tainted?.should == true
+ "hello".taint.capitalize.tainted?.should == true
+ end
+
+ it "is locale insensitive (only upcases a-z and only downcases A-Z)" do
+ "ÄÖÜ".capitalize.should == "ÄÖÜ"
+ "ärger".capitalize.should == "ärger"
+ "BÄR".capitalize.should == "BÄr"
+ end
+
+ it "returns subclass instances when called on a subclass" do
+ StringSpecs::MyString.new("hello").capitalize.class.should == StringSpecs::MyString
+ StringSpecs::MyString.new("Hello").capitalize.class.should == StringSpecs::MyString
+ end
+end
+
+describe "String#capitalize!" do
+ it "capitalizes self in place" do
+ a = "hello"
+ a.capitalize!.should equal(a)
+ a.should == "Hello"
+ end
+
+ it "returns nil when no changes are made" do
+ a = "Hello"
+ a.capitalize!.should == nil
+ a.should == "Hello"
+
+ "".capitalize!.should == nil
+ "H".capitalize!.should == nil
+ end
+
+ it "raises a TypeError when self is frozen" do
+ ["", "Hello", "hello"].each do |a|
+ a.freeze
+ lambda { a.capitalize! }.should raise_error(TypeError)
+ end
+ end
+end
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/concat_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/concat_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/concat_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,11 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-require File.dirname(__FILE__) + '/shared/concat.rb'
-
-describe "String#concat" do
- it_behaves_like :string_concat, :concat
-end
-
-describe "String#concat with Fixnum" do
- it_behaves_like :string_concat_fixnum, :concat
-end
Copied: MacRuby/branches/experimental/spec/frozen/core/string/concat_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/concat_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/concat_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/concat_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,11 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+require File.dirname(__FILE__) + '/shared/concat.rb'
+
+describe "String#concat" do
+ it_behaves_like :string_concat, :concat
+end
+
+describe "String#concat with Fixnum" do
+ it_behaves_like :string_concat_fixnum, :concat
+end
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/downcase_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/downcase_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/downcase_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,51 +0,0 @@
-# -*- encoding: utf-8 -*-
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-
-describe "String#downcase" do
- it "returns a copy of self with all uppercase letters downcased" do
- "hELLO".downcase.should == "hello"
- "hello".downcase.should == "hello"
- end
-
- it "is locale insensitive (only replaces A-Z)" do
- "ÄÖÜ".downcase.should == "ÄÖÜ"
-
- str = Array.new(256) { |c| c.chr }.join
- expected = Array.new(256) do |i|
- c = i.chr
- c.between?("A", "Z") ? c.downcase : c
- end.join
-
- str.downcase.should == expected
- end
-
- it "taints result when self is tainted" do
- "".taint.downcase.tainted?.should == true
- "x".taint.downcase.tainted?.should == true
- "X".taint.downcase.tainted?.should == true
- end
-
- it "returns a subclass instance for subclasses" do
- StringSpecs::MyString.new("FOObar").downcase.class.should == StringSpecs::MyString
- end
-end
-
-describe "String#downcase!" do
- it "modifies self in place" do
- a = "HeLlO"
- a.downcase!.should equal(a)
- a.should == "hello"
- end
-
- it "returns nil if no modifications were made" do
- a = "hello"
- a.downcase!.should == nil
- a.should == "hello"
- end
-
- it "raises a TypeError when self is frozen" do
- lambda { "HeLlo".freeze.downcase! }.should raise_error(TypeError)
- lambda { "hello".freeze.downcase! }.should raise_error(TypeError)
- end
-end
Copied: MacRuby/branches/experimental/spec/frozen/core/string/downcase_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/downcase_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/downcase_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/downcase_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,51 @@
+# -*- encoding: utf-8 -*-
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+
+describe "String#downcase" do
+ it "returns a copy of self with all uppercase letters downcased" do
+ "hELLO".downcase.should == "hello"
+ "hello".downcase.should == "hello"
+ end
+
+ it "is locale insensitive (only replaces A-Z)" do
+ "ÄÖÜ".downcase.should == "ÄÖÜ"
+
+ str = Array.new(256) { |c| c.chr }.join
+ expected = Array.new(256) do |i|
+ c = i.chr
+ c.between?("A", "Z") ? c.downcase : c
+ end.join
+
+ str.downcase.should == expected
+ end
+
+ it "taints result when self is tainted" do
+ "".taint.downcase.tainted?.should == true
+ "x".taint.downcase.tainted?.should == true
+ "X".taint.downcase.tainted?.should == true
+ end
+
+ it "returns a subclass instance for subclasses" do
+ StringSpecs::MyString.new("FOObar").downcase.class.should == StringSpecs::MyString
+ end
+end
+
+describe "String#downcase!" do
+ it "modifies self in place" do
+ a = "HeLlO"
+ a.downcase!.should equal(a)
+ a.should == "hello"
+ end
+
+ it "returns nil if no modifications were made" do
+ a = "hello"
+ a.downcase!.should == nil
+ a.should == "hello"
+ end
+
+ it "raises a TypeError when self is frozen" do
+ lambda { "HeLlo".freeze.downcase! }.should raise_error(TypeError)
+ lambda { "hello".freeze.downcase! }.should raise_error(TypeError)
+ end
+end
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/dump_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/dump_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/dump_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,33 +0,0 @@
-# -*- encoding: utf-8 -*-
-require File.dirname(__FILE__) + '/../../spec_helper'
-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\""
- end
-
- 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
-
- it "taints result when self is tainted" do
- "".taint.dump.tainted?.should == true
- "x".taint.dump.tainted?.should == true
- end
-
- it "returns a subclass instance for subclasses" do
- StringSpecs::MyString.new("hi!").dump.class.should == StringSpecs::MyString
- end
-end
Copied: MacRuby/branches/experimental/spec/frozen/core/string/dump_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/dump_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/dump_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/dump_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,33 @@
+# -*- encoding: utf-8 -*-
+require File.dirname(__FILE__) + '/../../spec_helper'
+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\""
+ end
+
+ 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
+
+ it "taints result when self is tainted" do
+ "".taint.dump.tainted?.should == true
+ "x".taint.dump.tainted?.should == true
+ end
+
+ it "returns a subclass instance for subclasses" do
+ StringSpecs::MyString.new("hi!").dump.class.should == StringSpecs::MyString
+ end
+end
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/each_byte_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/each_byte_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/each_byte_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,49 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-
-describe "String#each_byte" do
- it "passes each byte in self to the given block" do
- a = []
- "hello\x00".each_byte { |c| a << c }
- a.should == [104, 101, 108, 108, 111, 0]
- end
-
- it "keeps iterating from the old position (to new string end) when self changes" do
- r = ""
- s = "hello world"
- s.each_byte do |c|
- r << c
- s.insert(0, "<>") if r.size < 3
- end
- r.should == "h><>hello world"
-
- r = ""
- s = "hello world"
- s.each_byte { |c| s.slice!(-1); r << c }
- r.should == "hello "
-
- r = ""
- s = "hello world"
- s.each_byte { |c| s.slice!(0); r << c }
- r.should == "hlowrd"
-
- r = ""
- s = "hello world"
- s.each_byte { |c| s.slice!(0..-1); r << c }
- r.should == "h"
- end
-
- it "returns self" do
- s = "hello"
- (s.each_byte {}).should equal(s)
- end
-
- ruby_version_is "1.8.7" do
- it "returns an enumerator when no block given" do
- enum = "hello".each_byte
- enum.should be_kind_of(enumerator_class)
- enum.to_a.should == [104, 101, 108, 108, 111]
- end
- end
-
-end
Copied: MacRuby/branches/experimental/spec/frozen/core/string/each_byte_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/each_byte_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/each_byte_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/each_byte_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,49 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+
+describe "String#each_byte" do
+ it "passes each byte in self to the given block" do
+ a = []
+ "hello\x00".each_byte { |c| a << c }
+ a.should == [104, 101, 108, 108, 111, 0]
+ end
+
+ it "keeps iterating from the old position (to new string end) when self changes" do
+ r = ""
+ s = "hello world"
+ s.each_byte do |c|
+ r << c
+ s.insert(0, "<>") if r.size < 3
+ end
+ r.should == "h><>hello world"
+
+ r = ""
+ s = "hello world"
+ s.each_byte { |c| s.slice!(-1); r << c }
+ r.should == "hello "
+
+ r = ""
+ s = "hello world"
+ s.each_byte { |c| s.slice!(0); r << c }
+ r.should == "hlowrd"
+
+ r = ""
+ s = "hello world"
+ s.each_byte { |c| s.slice!(0..-1); r << c }
+ r.should == "h"
+ end
+
+ it "returns self" do
+ s = "hello"
+ (s.each_byte {}).should equal(s)
+ end
+
+ ruby_version_is "1.8.7" do
+ it "returns an enumerator when no block given" do
+ enum = "hello".each_byte
+ enum.should be_kind_of(enumerator_class)
+ enum.to_a.should == [104, 101, 108, 108, 111]
+ end
+ end
+
+end
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/element_reference_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/element_reference_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/element_reference_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,27 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-require File.dirname(__FILE__) + '/shared/slice.rb'
-
-describe "String#[]" do
- it_behaves_like :string_slice, :[]
-end
-
-describe "String#[] with index, length" do
- it_behaves_like :string_slice_index_length, :[]
-end
-
-describe "String#[] with Range" do
- it_behaves_like :string_slice_range, :[]
-end
-
-describe "String#[] with Regexp" do
- it_behaves_like :string_slice_regexp, :[]
-end
-
-describe "String#[] with Regexp, index" do
- it_behaves_like :string_slice_regexp_index, :[]
-end
-
-describe "String#[] with String" do
- it_behaves_like :string_slice_string, :[]
-end
Copied: MacRuby/branches/experimental/spec/frozen/core/string/element_reference_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/element_reference_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/element_reference_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/element_reference_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,27 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+require File.dirname(__FILE__) + '/shared/slice.rb'
+
+describe "String#[]" do
+ it_behaves_like :string_slice, :[]
+end
+
+describe "String#[] with index, length" do
+ it_behaves_like :string_slice_index_length, :[]
+end
+
+describe "String#[] with Range" do
+ it_behaves_like :string_slice_range, :[]
+end
+
+describe "String#[] with Regexp" do
+ it_behaves_like :string_slice_regexp, :[]
+end
+
+describe "String#[] with Regexp, index" do
+ it_behaves_like :string_slice_regexp_index, :[]
+end
+
+describe "String#[] with String" do
+ it_behaves_like :string_slice_string, :[]
+end
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/eql_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/eql_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/eql_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,20 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-require File.dirname(__FILE__) + '/shared/equal_value.rb'
-
-describe "String#eql?" do
- it_behaves_like(:string_equal_value, :eql?)
-end
-
-describe "String#eql? when given a non-String" do
- it "returns false" do
- 'hello'.should_not eql(5)
- 'hello'.should_not eql(:hello)
- 'hello'.should_not eql(mock('x'))
- end
-
- it "does not try to call #to_str on the given argument" do
- (obj = mock('x')).should_not_receive(:to_str)
- 'hello'.should_not eql(obj)
- end
-end
\ No newline at end of file
Copied: MacRuby/branches/experimental/spec/frozen/core/string/eql_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/eql_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/eql_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/eql_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,20 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+require File.dirname(__FILE__) + '/shared/equal_value.rb'
+
+describe "String#eql?" do
+ it_behaves_like(:string_equal_value, :eql?)
+end
+
+describe "String#eql? when given a non-String" do
+ it "returns false" do
+ 'hello'.should_not eql(5)
+ 'hello'.should_not eql(:hello)
+ 'hello'.should_not eql(mock('x'))
+ end
+
+ it "does not try to call #to_str on the given argument" do
+ (obj = mock('x')).should_not_receive(:to_str)
+ 'hello'.should_not eql(obj)
+ end
+end
\ No newline at end of file
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/equal_value_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/equal_value_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/equal_value_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,27 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-require File.dirname(__FILE__) + '/shared/equal_value.rb'
-
-describe "String#==" do
- it_behaves_like(:string_equal_value, :==)
-end
-
-describe "String#==" do
- it "returns false if obj does not respond to to_str" do
- ('hello' == 5).should == false
- ('hello' == :hello).should == false
- ('hello' == mock('x')).should == false
- end
-
- it "returns obj == self if obj responds to to_str" do
- obj = Object.new
-
- # String#== merely checks if #to_str is defined. It does
- # not call it.
- obj.stub!(:to_str)
-
- obj.should_receive(:==).and_return(true)
-
- ('hello' == obj).should == true
- end
-end
Copied: MacRuby/branches/experimental/spec/frozen/core/string/equal_value_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/equal_value_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/equal_value_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/equal_value_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,27 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+require File.dirname(__FILE__) + '/shared/equal_value.rb'
+
+describe "String#==" do
+ it_behaves_like(:string_equal_value, :==)
+end
+
+describe "String#==" do
+ it "returns false if obj does not respond to to_str" do
+ ('hello' == 5).should == false
+ ('hello' == :hello).should == false
+ ('hello' == mock('x')).should == false
+ end
+
+ it "returns obj == self if obj responds to to_str" do
+ obj = Object.new
+
+ # String#== merely checks if #to_str is defined. It does
+ # not call it.
+ obj.stub!(:to_str)
+
+ obj.should_receive(:==).and_return(true)
+
+ ('hello' == obj).should == true
+ end
+end
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/getbyte_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/getbyte_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/getbyte_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,37 +0,0 @@
-# coding: UTF-8
-ruby_version_is "1.9" do
- describe "String#getbyte" do
- it "returns the same value whatever the encoding, even if valid_encoding? is false" do
- str = 'こんにちは'
- ['ASCII-8BIT', 'EUC-JP'].each do |encoding|
- str2 = str.dup
- str2.force_encoding(encoding)
- (1...str.bytesize).each do |i|
- str2.getbyte(i).should == str.getbyte(i)
- end
- end
- end
-
- it "returns the (n+1)th byte from the start of a string if n >= 0" do
- str = "\xE3\x81\x82" # 'あ' in UTF-8
- str.getbyte(0).should == 0xE3
- str.getbyte(1).should == 0x81
- str.getbyte(2).should == 0x82
- end
-
- it "returns the (-n)th byte from the end of a string if n < 0" do
- str = "\xE3\x81\x82" # 'あ' in UTF-8
- str.getbyte(-3).should == 0xE3
- str.getbyte(-2).should == 0x81
- str.getbyte(-1).should == 0x82
- end
-
- it "returns nil for an offset outside the string" do
- str = "abcdef"
- str.getbyte(6).should be_nil
- str.getbyte(100).should be_nil
- str.getbyte(-100).should be_nil
- str.getbyte(-7).should be_nil
- end
- end
-end
Copied: MacRuby/branches/experimental/spec/frozen/core/string/getbyte_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/getbyte_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/getbyte_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/getbyte_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,37 @@
+# coding: UTF-8
+ruby_version_is "1.9" do
+ describe "String#getbyte" do
+ it "returns the same value whatever the encoding, even if valid_encoding? is false" do
+ str = 'こんにちは'
+ ['ASCII-8BIT', 'EUC-JP'].each do |encoding|
+ str2 = str.dup
+ str2.force_encoding(encoding)
+ (1...str.bytesize).each do |i|
+ str2.getbyte(i).should == str.getbyte(i)
+ end
+ end
+ end
+
+ it "returns the (n+1)th byte from the start of a string if n >= 0" do
+ str = "\xE3\x81\x82" # 'あ' in UTF-8
+ str.getbyte(0).should == 0xE3
+ str.getbyte(1).should == 0x81
+ str.getbyte(2).should == 0x82
+ end
+
+ it "returns the (-n)th byte from the end of a string if n < 0" do
+ str = "\xE3\x81\x82" # 'あ' in UTF-8
+ str.getbyte(-3).should == 0xE3
+ str.getbyte(-2).should == 0x81
+ str.getbyte(-1).should == 0x82
+ end
+
+ it "returns nil for an offset outside the string" do
+ str = "abcdef"
+ str.getbyte(6).should be_nil
+ str.getbyte(100).should be_nil
+ str.getbyte(-100).should be_nil
+ str.getbyte(-7).should be_nil
+ end
+ end
+end
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/inspect_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/inspect_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/inspect_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,48 +0,0 @@
-# -*- encoding: utf-8 -*-
-require File.dirname(__FILE__) + '/../../spec_helper'
-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\""
- end
-
- it "produces different output based on $KCODE" do
- old_kcode = $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
-
- it "taints the result if self is tainted" do
- "foo".taint.inspect.tainted?.should == true
- "foo\n".taint.inspect.tainted?.should == true
- end
-
- it "does not return subclass instances" do
- str = StringSpecs::MyString.new
- str << "test"
- str.should == "test"
- str.inspect.class.should_not == StringSpecs::MyString
- end
-end
Copied: MacRuby/branches/experimental/spec/frozen/core/string/inspect_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/inspect_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/inspect_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/inspect_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,48 @@
+# -*- encoding: utf-8 -*-
+require File.dirname(__FILE__) + '/../../spec_helper'
+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\""
+ end
+
+ it "produces different output based on $KCODE" do
+ old_kcode = $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
+
+ it "taints the result if self is tainted" do
+ "foo".taint.inspect.tainted?.should == true
+ "foo\n".taint.inspect.tainted?.should == true
+ end
+
+ it "does not return subclass instances" do
+ str = StringSpecs::MyString.new
+ str << "test"
+ str.should == "test"
+ str.inspect.class.should_not == StringSpecs::MyString
+ end
+end
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/intern_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/intern_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/intern_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,7 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-require File.dirname(__FILE__) + '/shared/to_sym.rb'
-
-describe "String#intern" do
- it_behaves_like(:string_to_sym, :intern)
-end
\ No newline at end of file
Copied: MacRuby/branches/experimental/spec/frozen/core/string/intern_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/intern_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/intern_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/intern_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,7 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+require File.dirname(__FILE__) + '/shared/to_sym.rb'
+
+describe "String#intern" do
+ it_behaves_like(:string_to_sym, :intern)
+end
\ No newline at end of file
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/next_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/next_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/next_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,11 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-require File.dirname(__FILE__) + '/shared/succ.rb'
-
-describe "String#next" do
- it_behaves_like(:string_succ, :next)
-end
-
-describe "String#next!" do
- it_behaves_like(:string_succ_bang, :"next!")
-end
\ No newline at end of file
Copied: MacRuby/branches/experimental/spec/frozen/core/string/next_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/next_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/next_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/next_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,11 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+require File.dirname(__FILE__) + '/shared/succ.rb'
+
+describe "String#next" do
+ it_behaves_like(:string_succ, :next)
+end
+
+describe "String#next!" do
+ it_behaves_like(:string_succ_bang, :"next!")
+end
\ No newline at end of file
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/slice_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/slice_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/slice_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,426 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-require File.dirname(__FILE__) + '/shared/slice.rb'
-
-describe "String#slice" do
- it_behaves_like :string_slice, :slice
-end
-
-describe "String#slice with index, length" do
- it_behaves_like :string_slice_index_length, :slice
-end
-
-describe "String#slice with Range" do
- it_behaves_like :string_slice_range, :slice
-end
-
-describe "String#slice with Regexp" do
- it_behaves_like :string_slice_regexp, :slice
-end
-
-describe "String#slice with Regexp, index" do
- it_behaves_like :string_slice_regexp_index, :slice
-end
-
-describe "String#slice with String" do
- it_behaves_like :string_slice_string, :slice
-end
-
-describe "String#slice! with index" do
- it "deletes and return the char at the given position" do
- a = "hello"
- a.slice!(1).should == ?e
- a.should == "hllo"
- a.slice!(-1).should == ?o
- a.should == "hll"
- end
-
- it "returns nil if idx is outside of self" do
- a = "hello"
- a.slice!(20).should == nil
- a.should == "hello"
- a.slice!(-20).should == nil
- a.should == "hello"
- end
-
- it "raises a TypeError if self is frozen" do
- lambda { "hello".freeze.slice!(1) }.should raise_error(TypeError)
- end
-
- it "doesn't raise a TypeError 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
-
- it "calls to_int on index" do
- "hello".slice!(0.5).should == ?h
-
- obj = mock('1')
- # MRI calls this twice so we can't use should_receive here.
- def obj.to_int() 1 end
- "hello".slice!(obj).should == ?e
-
- obj = mock('1')
- def obj.respond_to?(name) name == :to_int ? true : super; end
- def obj.method_missing(name, *) name == :to_int ? 1 : super; end
- "hello".slice!(obj).should == ?e
- end
-end
-
-describe "String#slice! with index, length" do
- it "deletes and returns the substring at idx and the given length" do
- a = "hello"
- a.slice!(1, 2).should == "el"
- a.should == "hlo"
-
- a.slice!(1, 0).should == ""
- a.should == "hlo"
-
- a.slice!(-2, 4).should == "lo"
- a.should == "h"
- end
-
- it "always taints resulting strings when self is tainted" do
- str = "hello world"
- str.taint
-
- str.slice!(0, 0).tainted?.should == true
- str.slice!(2, 1).tainted?.should == true
- end
-
- it "returns nil if the given position is out of self" do
- a = "hello"
- a.slice(10, 3).should == nil
- a.should == "hello"
-
- a.slice(-10, 20).should == nil
- a.should == "hello"
- end
-
- it "returns nil if the length is negative" do
- a = "hello"
- a.slice(4, -3).should == nil
- a.should == "hello"
- end
-
- it "raises a TypeError if self is frozen" do
- lambda { "hello".freeze.slice!(1, 2) }.should raise_error(TypeError)
- end
-
- 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
-
- it "calls to_int on idx and length" do
- "hello".slice!(0.5, 2.5).should == "he"
-
- obj = mock('2')
- def obj.to_int() 2 end
- "hello".slice!(obj, obj).should == "ll"
-
- obj = mock('2')
- def obj.respond_to?(name) name == :to_int; end
- def obj.method_missing(name, *) name == :to_int ? 2 : super; end
- "hello".slice!(obj, obj).should == "ll"
- end
-
- it "returns subclass instances" do
- s = StringSpecs::MyString.new("hello")
- s.slice!(0, 0).class.should == StringSpecs::MyString
- s.slice!(0, 4).class.should == StringSpecs::MyString
- end
-end
-
-describe "String#slice! Range" do
- it "deletes and return the substring given by the offsets of the range" do
- a = "hello"
- a.slice!(1..3).should == "ell"
- a.should == "ho"
- a.slice!(0..0).should == "h"
- a.should == "o"
- a.slice!(0...0).should == ""
- a.should == "o"
-
- # Edge Case?
- "hello".slice!(-3..-9).should == ""
- end
-
- it "returns nil if the given range is out of self" do
- a = "hello"
- a.slice!(-6..-9).should == nil
- a.should == "hello"
-
- b = "hello"
- b.slice!(10..20).should == nil
- b.should == "hello"
- end
-
- it "always taints resulting strings when self is tainted" do
- str = "hello world"
- str.taint
-
- str.slice!(0..0).tainted?.should == true
- str.slice!(2..3).tainted?.should == true
- end
-
- it "returns subclass instances" do
- s = StringSpecs::MyString.new("hello")
- s.slice!(0...0).class.should == StringSpecs::MyString
- s.slice!(0..4).class.should == StringSpecs::MyString
- end
-
- it "calls to_int on range arguments" do
- from = mock('from')
- to = mock('to')
-
- # So we can construct a range out of them...
- def from.<=>(o) 0 end
- def to.<=>(o) 0 end
-
- def from.to_int() 1 end
- def to.to_int() -2 end
-
- "hello there".slice!(from..to).should == "ello ther"
-
- from = mock('from')
- to = mock('to')
-
- def from.<=>(o) 0 end
- def to.<=>(o) 0 end
-
- def from.respond_to?(name) name == :to_int; end
- def from.method_missing(name) name == :to_int ? 1 : super; end
- def to.respond_to?(name) name == :to_int; end
- def to.method_missing(name) name == :to_int ? -2 : super; end
-
- "hello there".slice!(from..to).should == "ello ther"
- end
-
- it "works with Range subclasses" do
- a = "GOOD"
- range_incl = StringSpecs::MyRange.new(1, 2)
-
- a.slice!(range_incl).should == "OO"
- end
-
- it "raises a TypeError if self is frozen" do
- lambda { "hello".freeze.slice!(1..3) }.should raise_error(TypeError)
- end
-
- it "doesn't raise a TypeError if self is frozen but the given range is out of self" do
- "hello".freeze.slice!(10..20).should == nil
- end
-end
-
-describe "String#slice! with Regexp" do
- it "deletes and returns the first match from self" do
- s = "this is a string"
- s.slice!(/s.*t/).should == 's is a st'
- s.should == 'thiring'
-
- c = "hello hello"
- c.slice!(/llo/).should == "llo"
- c.should == "he hello"
- end
-
- it "returns nil if there was no match" do
- s = "this is a string"
- s.slice!(/zzz/).should == nil
- s.should == "this is a string"
- end
-
- it "always taints resulting strings when self or regexp is tainted" do
- strs = ["hello world"]
- strs += strs.map { |s| s.dup.taint }
-
- strs.each do |str|
- str = str.dup
- str.slice!(//).tainted?.should == str.tainted?
- str.slice!(/hello/).tainted?.should == str.tainted?
-
- tainted_re = /./
- tainted_re.taint
-
- str.slice!(tainted_re).tainted?.should == true
- end
- end
-
- it "doesn't taint self when regexp is tainted" do
- s = "hello"
- s.slice!(/./.taint)
- s.tainted?.should == false
- end
-
- it "returns subclass instances" do
- s = StringSpecs::MyString.new("hello")
- s.slice!(//).class.should == StringSpecs::MyString
- s.slice!(/../).class.should == StringSpecs::MyString
- end
-
- # This currently fails, but passes in a pure Rubinius environment (without mspec)
- # probably because mspec uses match internally for its operation
- it "sets $~ to MatchData when there is a match and nil when there's none" do
- 'hello'.slice!(/./)
- $~[0].should == 'h'
-
- 'hello'.slice!(/not/)
- $~.should == nil
- end
-
- it "raises a TypeError if self is frozen" do
- lambda { "this is a string".freeze.slice!(/s.*t/) }.should raise_error(TypeError)
- end
-
- 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
-
-describe "String#slice! with Regexp, index" do
- it "deletes and returns the capture for idx from self" do
- str = "hello there"
- str.slice!(/[aeiou](.)\1/, 0).should == "ell"
- str.should == "ho there"
- str.slice!(/(t)h/, 1).should == "t"
- str.should == "ho here"
- end
-
- it "always taints resulting strings when self or regexp is tainted" do
- strs = ["hello world"]
- strs += strs.map { |s| s.dup.taint }
-
- strs.each do |str|
- str = str.dup
- str.slice!(//, 0).tainted?.should == str.tainted?
- str.slice!(/hello/, 0).tainted?.should == str.tainted?
-
- tainted_re = /(.)(.)(.)/
- tainted_re.taint
-
- str.slice!(tainted_re, 1).tainted?.should == true
- end
- end
-
- it "doesn't taint self when regexp is tainted" do
- s = "hello"
- s.slice!(/(.)(.)/.taint, 1)
- s.tainted?.should == false
- end
-
- it "returns nil if there was no match" do
- s = "this is a string"
- s.slice!(/x(zzz)/, 1).should == nil
- s.should == "this is a string"
- end
-
- it "returns nil if there is no capture for idx" do
- "hello there".slice!(/[aeiou](.)\1/, 2).should == nil
- # You can't refer to 0 using negative indices
- "hello there".slice!(/[aeiou](.)\1/, -2).should == nil
- end
-
- it "calls to_int on idx" do
- obj = mock('2')
- def obj.to_int() 2 end
-
- "har".slice!(/(.)(.)(.)/, 1.5).should == "h"
- "har".slice!(/(.)(.)(.)/, obj).should == "a"
-
- obj = mock('2')
- def obj.respond_to?(name) name == :to_int; end
- def obj.method_missing(name) name == :to_int ? 2: super; end
- "har".slice!(/(.)(.)(.)/, obj).should == "a"
- end
-
- it "returns subclass instances" do
- s = StringSpecs::MyString.new("hello")
- s.slice!(/(.)(.)/, 0).class.should == StringSpecs::MyString
- s.slice!(/(.)(.)/, 1).class.should == StringSpecs::MyString
- end
-
- it "sets $~ to MatchData when there is a match and nil when there's none" do
- 'hello'[/.(.)/, 0]
- $~[0].should == 'he'
-
- 'hello'[/.(.)/, 1]
- $~[1].should == 'e'
-
- 'hello'[/not/, 0]
- $~.should == nil
- end
-
- it "raises a TypeError if self is frozen" do
- lambda { "this is a string".freeze.slice!(/s.*t/) }.should raise_error(TypeError)
- end
-
- it "doesn't raise a TypeError 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 TypeError if self is frozen but there is no capture for idx" do
- "this is a string".freeze.slice!(/(.)/, 2).should == nil
- end
-end
-
-describe "String#slice! with String" do
- it "removes and returns the first occurrence of other_str from self" do
- c = "hello hello"
- c.slice!('llo').should == "llo"
- c.should == "he hello"
- end
-
- it "taints resulting strings when other is tainted" do
- strs = ["", "hello world", "hello"]
- strs += strs.map { |s| s.dup.taint }
-
- strs.each do |str|
- str = str.dup
- strs.each do |other|
- other = other.dup
- r = str.slice!(other)
-
- r.tainted?.should == !r.nil? & other.tainted?
- end
- end
- end
-
- it "doesn't set $~" do
- $~ = nil
-
- 'hello'.slice!('ll')
- $~.should == nil
- end
-
- it "returns nil if self does not contain other" do
- a = "hello"
- a.slice!('zzz').should == nil
- a.should == "hello"
- end
-
- it "doesn't call to_str on its argument" do
- o = mock('x')
- o.should_not_receive(:to_str)
-
- lambda { "hello".slice!(o) }.should raise_error(TypeError)
- end
-
- it "returns a subclass instance when given a subclass instance" do
- s = StringSpecs::MyString.new("el")
- r = "hello".slice!(s)
- r.should == "el"
- r.class.should == StringSpecs::MyString
- end
-
- it "raises a TypeError if self is frozen" do
- lambda { "hello hello".freeze.slice!('llo') }.should raise_error(TypeError)
- end
-
- 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
Copied: MacRuby/branches/experimental/spec/frozen/core/string/slice_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/slice_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/slice_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/slice_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,426 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+require File.dirname(__FILE__) + '/shared/slice.rb'
+
+describe "String#slice" do
+ it_behaves_like :string_slice, :slice
+end
+
+describe "String#slice with index, length" do
+ it_behaves_like :string_slice_index_length, :slice
+end
+
+describe "String#slice with Range" do
+ it_behaves_like :string_slice_range, :slice
+end
+
+describe "String#slice with Regexp" do
+ it_behaves_like :string_slice_regexp, :slice
+end
+
+describe "String#slice with Regexp, index" do
+ it_behaves_like :string_slice_regexp_index, :slice
+end
+
+describe "String#slice with String" do
+ it_behaves_like :string_slice_string, :slice
+end
+
+describe "String#slice! with index" do
+ it "deletes and return the char at the given position" do
+ a = "hello"
+ a.slice!(1).should == ?e
+ a.should == "hllo"
+ a.slice!(-1).should == ?o
+ a.should == "hll"
+ end
+
+ it "returns nil if idx is outside of self" do
+ a = "hello"
+ a.slice!(20).should == nil
+ a.should == "hello"
+ a.slice!(-20).should == nil
+ a.should == "hello"
+ end
+
+ it "raises a TypeError if self is frozen" do
+ lambda { "hello".freeze.slice!(1) }.should raise_error(TypeError)
+ end
+
+ it "doesn't raise a TypeError 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
+
+ it "calls to_int on index" do
+ "hello".slice!(0.5).should == ?h
+
+ obj = mock('1')
+ # MRI calls this twice so we can't use should_receive here.
+ def obj.to_int() 1 end
+ "hello".slice!(obj).should == ?e
+
+ obj = mock('1')
+ def obj.respond_to?(name) name == :to_int ? true : super; end
+ def obj.method_missing(name, *) name == :to_int ? 1 : super; end
+ "hello".slice!(obj).should == ?e
+ end
+end
+
+describe "String#slice! with index, length" do
+ it "deletes and returns the substring at idx and the given length" do
+ a = "hello"
+ a.slice!(1, 2).should == "el"
+ a.should == "hlo"
+
+ a.slice!(1, 0).should == ""
+ a.should == "hlo"
+
+ a.slice!(-2, 4).should == "lo"
+ a.should == "h"
+ end
+
+ it "always taints resulting strings when self is tainted" do
+ str = "hello world"
+ str.taint
+
+ str.slice!(0, 0).tainted?.should == true
+ str.slice!(2, 1).tainted?.should == true
+ end
+
+ it "returns nil if the given position is out of self" do
+ a = "hello"
+ a.slice(10, 3).should == nil
+ a.should == "hello"
+
+ a.slice(-10, 20).should == nil
+ a.should == "hello"
+ end
+
+ it "returns nil if the length is negative" do
+ a = "hello"
+ a.slice(4, -3).should == nil
+ a.should == "hello"
+ end
+
+ it "raises a TypeError if self is frozen" do
+ lambda { "hello".freeze.slice!(1, 2) }.should raise_error(TypeError)
+ end
+
+ 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
+
+ it "calls to_int on idx and length" do
+ "hello".slice!(0.5, 2.5).should == "he"
+
+ obj = mock('2')
+ def obj.to_int() 2 end
+ "hello".slice!(obj, obj).should == "ll"
+
+ obj = mock('2')
+ def obj.respond_to?(name) name == :to_int; end
+ def obj.method_missing(name, *) name == :to_int ? 2 : super; end
+ "hello".slice!(obj, obj).should == "ll"
+ end
+
+ it "returns subclass instances" do
+ s = StringSpecs::MyString.new("hello")
+ s.slice!(0, 0).class.should == StringSpecs::MyString
+ s.slice!(0, 4).class.should == StringSpecs::MyString
+ end
+end
+
+describe "String#slice! Range" do
+ it "deletes and return the substring given by the offsets of the range" do
+ a = "hello"
+ a.slice!(1..3).should == "ell"
+ a.should == "ho"
+ a.slice!(0..0).should == "h"
+ a.should == "o"
+ a.slice!(0...0).should == ""
+ a.should == "o"
+
+ # Edge Case?
+ "hello".slice!(-3..-9).should == ""
+ end
+
+ it "returns nil if the given range is out of self" do
+ a = "hello"
+ a.slice!(-6..-9).should == nil
+ a.should == "hello"
+
+ b = "hello"
+ b.slice!(10..20).should == nil
+ b.should == "hello"
+ end
+
+ it "always taints resulting strings when self is tainted" do
+ str = "hello world"
+ str.taint
+
+ str.slice!(0..0).tainted?.should == true
+ str.slice!(2..3).tainted?.should == true
+ end
+
+ it "returns subclass instances" do
+ s = StringSpecs::MyString.new("hello")
+ s.slice!(0...0).class.should == StringSpecs::MyString
+ s.slice!(0..4).class.should == StringSpecs::MyString
+ end
+
+ it "calls to_int on range arguments" do
+ from = mock('from')
+ to = mock('to')
+
+ # So we can construct a range out of them...
+ def from.<=>(o) 0 end
+ def to.<=>(o) 0 end
+
+ def from.to_int() 1 end
+ def to.to_int() -2 end
+
+ "hello there".slice!(from..to).should == "ello ther"
+
+ from = mock('from')
+ to = mock('to')
+
+ def from.<=>(o) 0 end
+ def to.<=>(o) 0 end
+
+ def from.respond_to?(name) name == :to_int; end
+ def from.method_missing(name) name == :to_int ? 1 : super; end
+ def to.respond_to?(name) name == :to_int; end
+ def to.method_missing(name) name == :to_int ? -2 : super; end
+
+ "hello there".slice!(from..to).should == "ello ther"
+ end
+
+ it "works with Range subclasses" do
+ a = "GOOD"
+ range_incl = StringSpecs::MyRange.new(1, 2)
+
+ a.slice!(range_incl).should == "OO"
+ end
+
+ it "raises a TypeError if self is frozen" do
+ lambda { "hello".freeze.slice!(1..3) }.should raise_error(TypeError)
+ end
+
+ it "doesn't raise a TypeError if self is frozen but the given range is out of self" do
+ "hello".freeze.slice!(10..20).should == nil
+ end
+end
+
+describe "String#slice! with Regexp" do
+ it "deletes and returns the first match from self" do
+ s = "this is a string"
+ s.slice!(/s.*t/).should == 's is a st'
+ s.should == 'thiring'
+
+ c = "hello hello"
+ c.slice!(/llo/).should == "llo"
+ c.should == "he hello"
+ end
+
+ it "returns nil if there was no match" do
+ s = "this is a string"
+ s.slice!(/zzz/).should == nil
+ s.should == "this is a string"
+ end
+
+ it "always taints resulting strings when self or regexp is tainted" do
+ strs = ["hello world"]
+ strs += strs.map { |s| s.dup.taint }
+
+ strs.each do |str|
+ str = str.dup
+ str.slice!(//).tainted?.should == str.tainted?
+ str.slice!(/hello/).tainted?.should == str.tainted?
+
+ tainted_re = /./
+ tainted_re.taint
+
+ str.slice!(tainted_re).tainted?.should == true
+ end
+ end
+
+ it "doesn't taint self when regexp is tainted" do
+ s = "hello"
+ s.slice!(/./.taint)
+ s.tainted?.should == false
+ end
+
+ it "returns subclass instances" do
+ s = StringSpecs::MyString.new("hello")
+ s.slice!(//).class.should == StringSpecs::MyString
+ s.slice!(/../).class.should == StringSpecs::MyString
+ end
+
+ # This currently fails, but passes in a pure Rubinius environment (without mspec)
+ # probably because mspec uses match internally for its operation
+ it "sets $~ to MatchData when there is a match and nil when there's none" do
+ 'hello'.slice!(/./)
+ $~[0].should == 'h'
+
+ 'hello'.slice!(/not/)
+ $~.should == nil
+ end
+
+ it "raises a TypeError if self is frozen" do
+ lambda { "this is a string".freeze.slice!(/s.*t/) }.should raise_error(TypeError)
+ end
+
+ 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
+
+describe "String#slice! with Regexp, index" do
+ it "deletes and returns the capture for idx from self" do
+ str = "hello there"
+ str.slice!(/[aeiou](.)\1/, 0).should == "ell"
+ str.should == "ho there"
+ str.slice!(/(t)h/, 1).should == "t"
+ str.should == "ho here"
+ end
+
+ it "always taints resulting strings when self or regexp is tainted" do
+ strs = ["hello world"]
+ strs += strs.map { |s| s.dup.taint }
+
+ strs.each do |str|
+ str = str.dup
+ str.slice!(//, 0).tainted?.should == str.tainted?
+ str.slice!(/hello/, 0).tainted?.should == str.tainted?
+
+ tainted_re = /(.)(.)(.)/
+ tainted_re.taint
+
+ str.slice!(tainted_re, 1).tainted?.should == true
+ end
+ end
+
+ it "doesn't taint self when regexp is tainted" do
+ s = "hello"
+ s.slice!(/(.)(.)/.taint, 1)
+ s.tainted?.should == false
+ end
+
+ it "returns nil if there was no match" do
+ s = "this is a string"
+ s.slice!(/x(zzz)/, 1).should == nil
+ s.should == "this is a string"
+ end
+
+ it "returns nil if there is no capture for idx" do
+ "hello there".slice!(/[aeiou](.)\1/, 2).should == nil
+ # You can't refer to 0 using negative indices
+ "hello there".slice!(/[aeiou](.)\1/, -2).should == nil
+ end
+
+ it "calls to_int on idx" do
+ obj = mock('2')
+ def obj.to_int() 2 end
+
+ "har".slice!(/(.)(.)(.)/, 1.5).should == "h"
+ "har".slice!(/(.)(.)(.)/, obj).should == "a"
+
+ obj = mock('2')
+ def obj.respond_to?(name) name == :to_int; end
+ def obj.method_missing(name) name == :to_int ? 2: super; end
+ "har".slice!(/(.)(.)(.)/, obj).should == "a"
+ end
+
+ it "returns subclass instances" do
+ s = StringSpecs::MyString.new("hello")
+ s.slice!(/(.)(.)/, 0).class.should == StringSpecs::MyString
+ s.slice!(/(.)(.)/, 1).class.should == StringSpecs::MyString
+ end
+
+ it "sets $~ to MatchData when there is a match and nil when there's none" do
+ 'hello'[/.(.)/, 0]
+ $~[0].should == 'he'
+
+ 'hello'[/.(.)/, 1]
+ $~[1].should == 'e'
+
+ 'hello'[/not/, 0]
+ $~.should == nil
+ end
+
+ it "raises a TypeError if self is frozen" do
+ lambda { "this is a string".freeze.slice!(/s.*t/) }.should raise_error(TypeError)
+ end
+
+ it "doesn't raise a TypeError 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 TypeError if self is frozen but there is no capture for idx" do
+ "this is a string".freeze.slice!(/(.)/, 2).should == nil
+ end
+end
+
+describe "String#slice! with String" do
+ it "removes and returns the first occurrence of other_str from self" do
+ c = "hello hello"
+ c.slice!('llo').should == "llo"
+ c.should == "he hello"
+ end
+
+ it "taints resulting strings when other is tainted" do
+ strs = ["", "hello world", "hello"]
+ strs += strs.map { |s| s.dup.taint }
+
+ strs.each do |str|
+ str = str.dup
+ strs.each do |other|
+ other = other.dup
+ r = str.slice!(other)
+
+ r.tainted?.should == !r.nil? & other.tainted?
+ end
+ end
+ end
+
+ it "doesn't set $~" do
+ $~ = nil
+
+ 'hello'.slice!('ll')
+ $~.should == nil
+ end
+
+ it "returns nil if self does not contain other" do
+ a = "hello"
+ a.slice!('zzz').should == nil
+ a.should == "hello"
+ end
+
+ it "doesn't call to_str on its argument" do
+ o = mock('x')
+ o.should_not_receive(:to_str)
+
+ lambda { "hello".slice!(o) }.should raise_error(TypeError)
+ end
+
+ it "returns a subclass instance when given a subclass instance" do
+ s = StringSpecs::MyString.new("el")
+ r = "hello".slice!(s)
+ r.should == "el"
+ r.class.should == StringSpecs::MyString
+ end
+
+ it "raises a TypeError if self is frozen" do
+ lambda { "hello hello".freeze.slice!('llo') }.should raise_error(TypeError)
+ end
+
+ 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
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/succ_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/succ_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/succ_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,11 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-require File.dirname(__FILE__) + '/shared/succ.rb'
-
-describe "String#succ" do
- it_behaves_like(:string_succ, :succ)
-end
-
-describe "String#succ!" do
- it_behaves_like(:string_succ_bang, :"succ!")
-end
\ No newline at end of file
Copied: MacRuby/branches/experimental/spec/frozen/core/string/succ_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/succ_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/succ_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/succ_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,11 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+require File.dirname(__FILE__) + '/shared/succ.rb'
+
+describe "String#succ" do
+ it_behaves_like(:string_succ, :succ)
+end
+
+describe "String#succ!" do
+ it_behaves_like(:string_succ_bang, :"succ!")
+end
\ No newline at end of file
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/swapcase_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/swapcase_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/swapcase_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,50 +0,0 @@
-# -*- encoding: utf-8 -*-
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-
-describe "String#swapcase" do
- it "returns a new string with all uppercase chars from self converted to lowercase and vice versa" do
- "Hello".swapcase.should == "hELLO"
- "cYbEr_PuNk11".swapcase.should == "CyBeR_pUnK11"
- "+++---111222???".swapcase.should == "+++---111222???"
- end
-
- it "taints resulting string when self is tainted" do
- "".taint.swapcase.tainted?.should == true
- "hello".taint.swapcase.tainted?.should == true
- end
-
- it "is locale insensitive (only upcases a-z and only downcases A-Z)" do
- "ÄÖÜ".swapcase.should == "ÄÖÜ"
- "ärger".swapcase.should == "äRGER"
- "BÄR".swapcase.should == "bÄr"
- end
-
- it "returns subclass instances when called on a subclass" do
- StringSpecs::MyString.new("").swapcase.class.should == StringSpecs::MyString
- StringSpecs::MyString.new("hello").swapcase.class.should == StringSpecs::MyString
- end
-end
-
-describe "String#swapcase!" do
- it "modifies self in place" do
- a = "cYbEr_PuNk11"
- a.swapcase!.should equal(a)
- a.should == "CyBeR_pUnK11"
- end
-
- it "returns nil if no modifications were made" do
- a = "+++---111222???"
- a.swapcase!.should == nil
- a.should == "+++---111222???"
-
- "".swapcase!.should == nil
- end
-
- it "raises a TypeError when self is frozen" do
- ["", "hello"].each do |a|
- a.freeze
- lambda { a.swapcase! }.should raise_error(TypeError)
- end
- end
-end
Copied: MacRuby/branches/experimental/spec/frozen/core/string/swapcase_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/swapcase_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/swapcase_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/swapcase_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,50 @@
+# -*- encoding: utf-8 -*-
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+
+describe "String#swapcase" do
+ it "returns a new string with all uppercase chars from self converted to lowercase and vice versa" do
+ "Hello".swapcase.should == "hELLO"
+ "cYbEr_PuNk11".swapcase.should == "CyBeR_pUnK11"
+ "+++---111222???".swapcase.should == "+++---111222???"
+ end
+
+ it "taints resulting string when self is tainted" do
+ "".taint.swapcase.tainted?.should == true
+ "hello".taint.swapcase.tainted?.should == true
+ end
+
+ it "is locale insensitive (only upcases a-z and only downcases A-Z)" do
+ "ÄÖÜ".swapcase.should == "ÄÖÜ"
+ "ärger".swapcase.should == "äRGER"
+ "BÄR".swapcase.should == "bÄr"
+ end
+
+ it "returns subclass instances when called on a subclass" do
+ StringSpecs::MyString.new("").swapcase.class.should == StringSpecs::MyString
+ StringSpecs::MyString.new("hello").swapcase.class.should == StringSpecs::MyString
+ end
+end
+
+describe "String#swapcase!" do
+ it "modifies self in place" do
+ a = "cYbEr_PuNk11"
+ a.swapcase!.should equal(a)
+ a.should == "CyBeR_pUnK11"
+ end
+
+ it "returns nil if no modifications were made" do
+ a = "+++---111222???"
+ a.swapcase!.should == nil
+ a.should == "+++---111222???"
+
+ "".swapcase!.should == nil
+ end
+
+ it "raises a TypeError when self is frozen" do
+ ["", "hello"].each do |a|
+ a.freeze
+ lambda { a.swapcase! }.should raise_error(TypeError)
+ end
+ end
+end
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/to_s_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/to_s_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/to_s_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,7 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-require File.dirname(__FILE__) + '/shared/to_s.rb'
-
-describe "String#to_s" do
- it_behaves_like(:string_to_s, :to_s)
-end
\ No newline at end of file
Copied: MacRuby/branches/experimental/spec/frozen/core/string/to_s_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/to_s_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/to_s_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/to_s_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,7 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+require File.dirname(__FILE__) + '/shared/to_s.rb'
+
+describe "String#to_s" do
+ it_behaves_like(:string_to_s, :to_s)
+end
\ No newline at end of file
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/to_str_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/to_str_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/to_str_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,7 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-require File.dirname(__FILE__) + '/shared/to_s.rb'
-
-describe "String#to_str" do
- it_behaves_like(:string_to_s, :to_str)
-end
\ No newline at end of file
Copied: MacRuby/branches/experimental/spec/frozen/core/string/to_str_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/to_str_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/to_str_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/to_str_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,7 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+require File.dirname(__FILE__) + '/shared/to_s.rb'
+
+describe "String#to_str" do
+ it_behaves_like(:string_to_s, :to_str)
+end
\ No newline at end of file
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/to_sym_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/to_sym_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/to_sym_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,7 +0,0 @@
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-require File.dirname(__FILE__) + '/shared/to_sym.rb'
-
-describe "String#to_sym" do
- it_behaves_like(:string_to_sym, :to_sym)
-end
\ No newline at end of file
Copied: MacRuby/branches/experimental/spec/frozen/core/string/to_sym_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/to_sym_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/to_sym_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/to_sym_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,7 @@
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+require File.dirname(__FILE__) + '/shared/to_sym.rb'
+
+describe "String#to_sym" do
+ it_behaves_like(:string_to_sym, :to_sym)
+end
\ No newline at end of file
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/upcase_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/upcase_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/upcase_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,51 +0,0 @@
-# -*- encoding: utf-8 -*-
-require File.dirname(__FILE__) + '/../../spec_helper'
-require File.dirname(__FILE__) + '/fixtures/classes.rb'
-
-describe "String#upcase" do
- it "returns a copy of self with all lowercase letters upcased" do
- "Hello".upcase.should == "HELLO"
- "hello".upcase.should == "HELLO"
- end
-
- it "is locale insensitive (only replaces a-z)" do
- "äöü".upcase.should == "äöü"
-
- str = Array.new(256) { |c| c.chr }.join
- expected = Array.new(256) do |i|
- c = i.chr
- c.between?("a", "z") ? c.upcase : c
- end.join
-
- str.upcase.should == expected
- end
-
- it "taints result when self is tainted" do
- "".taint.upcase.tainted?.should == true
- "X".taint.upcase.tainted?.should == true
- "x".taint.upcase.tainted?.should == true
- end
-
- it "returns a subclass instance for subclasses" do
- StringSpecs::MyString.new("fooBAR").upcase.class.should == StringSpecs::MyString
- end
-end
-
-describe "String#upcase!" do
- it "modifies self in place" do
- a = "HeLlO"
- a.upcase!.should equal(a)
- a.should == "HELLO"
- end
-
- it "returns nil if no modifications were made" do
- a = "HELLO"
- a.upcase!.should == nil
- a.should == "HELLO"
- end
-
- it "raises a TypeError when self is frozen" do
- lambda { "HeLlo".freeze.upcase! }.should raise_error(TypeError)
- lambda { "HELLO".freeze.upcase! }.should raise_error(TypeError)
- end
-end
Copied: MacRuby/branches/experimental/spec/frozen/core/string/upcase_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/upcase_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/upcase_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/upcase_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,51 @@
+# -*- encoding: utf-8 -*-
+require File.dirname(__FILE__) + '/../../spec_helper'
+require File.dirname(__FILE__) + '/fixtures/classes.rb'
+
+describe "String#upcase" do
+ it "returns a copy of self with all lowercase letters upcased" do
+ "Hello".upcase.should == "HELLO"
+ "hello".upcase.should == "HELLO"
+ end
+
+ it "is locale insensitive (only replaces a-z)" do
+ "äöü".upcase.should == "äöü"
+
+ str = Array.new(256) { |c| c.chr }.join
+ expected = Array.new(256) do |i|
+ c = i.chr
+ c.between?("a", "z") ? c.upcase : c
+ end.join
+
+ str.upcase.should == expected
+ end
+
+ it "taints result when self is tainted" do
+ "".taint.upcase.tainted?.should == true
+ "X".taint.upcase.tainted?.should == true
+ "x".taint.upcase.tainted?.should == true
+ end
+
+ it "returns a subclass instance for subclasses" do
+ StringSpecs::MyString.new("fooBAR").upcase.class.should == StringSpecs::MyString
+ end
+end
+
+describe "String#upcase!" do
+ it "modifies self in place" do
+ a = "HeLlO"
+ a.upcase!.should equal(a)
+ a.should == "HELLO"
+ end
+
+ it "returns nil if no modifications were made" do
+ a = "HELLO"
+ a.upcase!.should == nil
+ a.should == "HELLO"
+ end
+
+ it "raises a TypeError when self is frozen" do
+ lambda { "HeLlo".freeze.upcase! }.should raise_error(TypeError)
+ lambda { "HELLO".freeze.upcase! }.should raise_error(TypeError)
+ end
+end
Deleted: MacRuby/branches/experimental/spec/frozen/core/string/valid_encoding_spec.rb
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/valid_encoding_spec.rb 2009-05-31 22:20:00 UTC (rev 1684)
+++ MacRuby/branches/experimental/spec/frozen/core/string/valid_encoding_spec.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -1,49 +0,0 @@
-# coding: UTF-8
-ruby_version_is "1.9" do
- describe "String#valid_encoding?" do
- it "returns true for a valid encoding" do
- "abcdef".valid_encoding?.should be_true
- "こんにちは".valid_encoding?.should be_true
- "\xE3\x81\x82".valid_encoding?.should be_true # 'あ' in UTF-8
- end
-
- it "returns true for a valid encoding and a null character" do
- "abc\0def".valid_encoding?.should be_true
- "こん\0にちは".valid_encoding?.should be_true
- "\0\xE3\x81\x82".valid_encoding?.should be_true # 'あ' in UTF-8
- end
-
- it "always returns true for binary encoding" do
- 'abcdef'.force_encoding('ASCII-8BIT').valid_encoding?.should be_true
- 'こんにちは'.force_encoding('ASCII-8BIT').valid_encoding?.should be_true
- "\xE3\x81\x82".force_encoding('ASCII-8BIT').valid_encoding?.should be_true # 'あ' in UTF-8
- "\xE3".force_encoding('ASCII-8BIT').valid_encoding?.should be_true
- end
-
- it "returns false for an invalid encoding" do
- "\xE3".valid_encoding?.should be_false
- "\xE3\x0\x82".valid_encoding?.should be_false
- "\xA4\xA2".valid_encoding?.should be_false # 'あ' in EUC-JP (invalid UTF-8)
- end
-
- it "returns false when a valid encoding has been made invalid" do
- str = 'こんにちは'
- str.setbyte(0, 0)
- str.valid_encoding?.should be_false
-
- str = 'こんにちは'
- str.force_encoding('EUC-JP')
- str.valid_encoding?.should be_false
- end
-
- it "returns true for an invalid encoding made valid" do
- str = "\xE3\x0\x82"
- str.setbyte(1, 0x81)
- str.valid_encoding?.should be_true
-
- str = "\xA4\xA2" # 'あ' in EUC-JP
- str.force_encoding('EUC-JP') # set the correct encoding
- str.valid_encoding?.should be_true
- end
- end
-end
Copied: MacRuby/branches/experimental/spec/frozen/core/string/valid_encoding_spec_disabled.rb (from rev 1684, MacRuby/branches/experimental/spec/frozen/core/string/valid_encoding_spec.rb)
===================================================================
--- MacRuby/branches/experimental/spec/frozen/core/string/valid_encoding_spec_disabled.rb (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/core/string/valid_encoding_spec_disabled.rb 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,49 @@
+# coding: UTF-8
+ruby_version_is "1.9" do
+ describe "String#valid_encoding?" do
+ it "returns true for a valid encoding" do
+ "abcdef".valid_encoding?.should be_true
+ "こんにちは".valid_encoding?.should be_true
+ "\xE3\x81\x82".valid_encoding?.should be_true # 'あ' in UTF-8
+ end
+
+ it "returns true for a valid encoding and a null character" do
+ "abc\0def".valid_encoding?.should be_true
+ "こん\0にちは".valid_encoding?.should be_true
+ "\0\xE3\x81\x82".valid_encoding?.should be_true # 'あ' in UTF-8
+ end
+
+ it "always returns true for binary encoding" do
+ 'abcdef'.force_encoding('ASCII-8BIT').valid_encoding?.should be_true
+ 'こんにちは'.force_encoding('ASCII-8BIT').valid_encoding?.should be_true
+ "\xE3\x81\x82".force_encoding('ASCII-8BIT').valid_encoding?.should be_true # 'あ' in UTF-8
+ "\xE3".force_encoding('ASCII-8BIT').valid_encoding?.should be_true
+ end
+
+ it "returns false for an invalid encoding" do
+ "\xE3".valid_encoding?.should be_false
+ "\xE3\x0\x82".valid_encoding?.should be_false
+ "\xA4\xA2".valid_encoding?.should be_false # 'あ' in EUC-JP (invalid UTF-8)
+ end
+
+ it "returns false when a valid encoding has been made invalid" do
+ str = 'こんにちは'
+ str.setbyte(0, 0)
+ str.valid_encoding?.should be_false
+
+ str = 'こんにちは'
+ str.force_encoding('EUC-JP')
+ str.valid_encoding?.should be_false
+ end
+
+ it "returns true for an invalid encoding made valid" do
+ str = "\xE3\x0\x82"
+ str.setbyte(1, 0x81)
+ str.valid_encoding?.should be_true
+
+ str = "\xA4\xA2" # 'あ' in EUC-JP
+ str.force_encoding('EUC-JP') # set the correct encoding
+ str.valid_encoding?.should be_true
+ end
+ end
+end
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/casecmp_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/casecmp_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/casecmp_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,2 @@
+fails:String#casecmp doesn't do case mapping for non-ascii characters
+fails:String#casecmp ignores subclass differences
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/center_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/center_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/center_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,5 @@
+critical:String#center with length, padding raises an ArgumentError if padstr is empty
+fails:String#center with length, padding returns a new string of specified length with self centered and padded with padstr
+fails:String#center with length, padding calls #to_str to convert padstr to a String
+fails:String#center with length, padding raises a TypeError when padstr can't be converted to a string
+fails:String#center with length, padding returns subclass instances when called on subclasses
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/chomp_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/chomp_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/chomp_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,7 @@
+critical:String#chomp with separator calls #to_str to convert separator to a String
+fails:String#chomp with separator removes carriage return (except \r) chars multiple times when separator is an empty string
+fails:String#chomp with separator taints result when self is tainted
+fails:String#chomp with separator raises a TypeError if separator can't be converted to a string
+fails:String#chomp with separator returns subclass instances when called on a subclass
+fails:String#chomp! with separator modifies self in place and returns self
+fails:String#chomp! with separator raises a TypeError when self is frozen
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/chop_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/chop_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/chop_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,3 @@
+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
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/comparison_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/comparison_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/comparison_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1 @@
+fails:String#<=> with String ignores subclass differences
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/count_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/count_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/count_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,3 @@
+fails:String#count negates sets starting with ^
+fails:String#count counts all chars in a sequence
+fails:String#count raises a TypeError when a set arg can't be converted to a string
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/crypt_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/crypt_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/crypt_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,2 @@
+fails:String#crypt taints the result if either salt or self is tainted
+fails:String#crypt doesn't return subclass instances
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/delete_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/delete_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/delete_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,6 @@
+fails:String#delete negates sets starting with ^
+fails:String#delete deletes all chars in a sequence
+fails:String#delete taints result when self is tainted
+fails:String#delete raises a TypeError when one set arg can't be converted to a string
+fails:String#delete returns subclass instances when called on a subclass
+fails:String#delete! raises a TypeError when self is frozen
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/each_char_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/each_char_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/each_char_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,3 @@
+fails:String#each_char returns an enumerator when no block given
+fails:String#each_char is unicode aware
+fails:String#each_char returns self
\ No newline at end of file
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/each_line_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/each_line_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/each_line_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,6 @@
+critical:String#each_line accept string-like separator
+fails:String#each_line taints substrings that are passed to the block if self is tainted
+fails:String#each_line appends multiple successive newlines together when the separator is an empty string
+fails:String#each_line yields subclass instances for subclasses
+fails:String#each_line not care if the string is modified while substituting
+fails:String#each_line returns an enumerator when no block given
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/element_set_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/element_set_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/element_set_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,8 @@
+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
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/empty_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/empty_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/empty_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1 @@
+fails:String#empty? returns true if the string has a length of zero
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/end_with_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/end_with_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/end_with_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1 @@
+fails:String#end_with? works for multibyte strings
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/entries_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/entries_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/entries_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,2 @@
+fails:String#entries returns an empty array for empty strings
+fails:String#entries returns an array containing the string for non-empty strings
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/gsub_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/gsub_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/gsub_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,14 @@
+fails:String#gsub with pattern and replacement doesn't interpret regexp metacharacters if pattern is a string
+fails:String#gsub with pattern and replacement taints the result if the original string or replacement is tainted
+fails:String#gsub with pattern and replacement untrusts the result if the original string or replacement is untrusted
+fails:String#gsub with pattern and replacement tries to convert pattern to a string using to_str
+fails:String#gsub with pattern and replacement raises a TypeError when pattern can't be converted to a string
+fails:String#gsub with pattern and replacement raises a TypeError when replacement can't be converted to a string
+fails:String#gsub with pattern and replacement returns subclass instances when called on a subclass
+fails:String#gsub with pattern and block raises a RuntimeError if the string is modified while substituting
+fails:String#gsub with pattern and block untrusts the result if the original string or replacement is untrusted
+fails:String#gsub! with pattern and replacement taints self if replacement is tainted
+fails:String#gsub! with pattern and replacement untrusts self if replacement is untrusted
+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
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/include_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/include_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/include_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,4 @@
+fails:String#include? with String ignores subclass differences
+fails:String#include? with String raises a TypeError if other can't be converted to string
+fails:String#include? with Fixnum returns true if self contains the given char
+fails:String#include? with Fixnum uses fixnum % 256
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/index_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/index_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/index_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,9 @@
+fails:String#index with object raises a TypeError if obj isn't a String, Fixnum or Regexp
+fails:String#index with Fixnum character values over 255 (256th ASCII character) always result in nil
+fails:String#index with Fixnum negative character values always result in nil
+fails:String#index with Fixnum returns nil if the character isn't found
+fails:String#index with String behaves the same as String#index(char) for one-character strings
+fails:String#index with String returns the index of the first occurrence of the given substring
+fails:String#index with String ignores string subclasses
+fails:String#index with String starts the search at the given offset
+fails:String#index with Regexp behaves the same as String#index(string) for escaped string regexps
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/initialize_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/initialize_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/initialize_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,6 @@
+critical:String#initialize raises TypeError on inconvertible object
+critical:String#initialize converts its argument to a string representation
+fails:String#initialize is a private method
+fails:String#initialize returns an instance of a subclass
+fails:String#initialize is called on subclasses
+fails:String#initialize raises a TypeError if self is frozen
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/insert_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/insert_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/insert_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,2 @@
+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
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/ljust_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/ljust_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/ljust_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,5 @@
+critical:String#ljust with length, padding raises an ArgumentError when padstr is empty
+fails:String#ljust with length, padding returns a new string of specified length with self left justified and padded with padstr
+fails:String#ljust with length, padding tries to convert padstr to a string using to_str
+fails:String#ljust with length, padding raises a TypeError when padstr can't be converted
+fails:String#ljust with length, padding returns subclass instances when called on subclasses
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/lstrip_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/lstrip_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/lstrip_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,2 @@
+fails:String#lstrip! modifies self in place and returns self
+fails:String#lstrip! raises a TypeError if self is frozen
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/match_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/match_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/match_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,3 @@
+fails:String#=~ raises a TypeError if a obj is a string
+fails:String#match tries to convert pattern to a string via to_str
+fails:String#match raises a TypeError if pattern is not a regexp or a string
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/modulo_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/modulo_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/modulo_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,57 @@
+critical:String#% supports binary formats using %B with same behaviour as %b except for using 0B instead of 0b for #
+critical:String#% supports negative bignums by prefixing the value with dots
+critical:String#% behaves as if calling Kernel#Integer for %b argument, if it does not respond to #to_ary
+fails:String#% formats multiple expressions
+fails:String#% formats single % characters before a newline or NULL as literal %s
+fails:String#% raises an error if single % appears anywhere else
+fails:String#% raises an error if NULL or
+fails: appear anywhere else in the format string
+fails:String#% ignores unused arguments when $DEBUG is false
+fails:String#% raises an ArgumentError for unused arguments when $DEBUG is true
+fails:String#% always allows unused arguments when positional argument style is used
+fails:String#% replaces trailing absolute argument specifier without type with percent sign
+fails:String#% raises an ArgumentError when given invalid argument specifiers
+fails:String#% raises an ArgumentError when multiple positional argument tokens are given for one format specifier
+fails:String#% raises an ArgumentError when multiple width star tokens are given for one format specifier
+fails:String#% raises an ArgumentError when a width star token is seen after a width token
+fails:String#% raises an ArgumentError when multiple precision tokens are given
+fails:String#% raises an ArgumentError when there are less arguments than format specifiers
+fails:String#% raises an ArgumentError when absolute and relative argument numbers are mixed
+fails:String#% allows reuse of the one argument multiple via absolute argument numbers
+fails:String#% always interprets an array argument as a list of argument parameters
+fails:String#% always interprets an array subclass argument as a list of argument parameters
+fails:String#% tries to convert the argument to Array by calling #to_ary
+fails:String#% doesn't return subclass instances when called on a subclass
+fails:String#% always taints the result when the format string is tainted
+fails:String#% supports binary formats using %b
+fails:String#% supports character formats using %c
+fails:String#% supports octal formats using %o
+fails:String#% supports inspect formats using %p
+fails:String#% calls inspect on arguments for %p format
+fails:String#% taints result for %p when argument.inspect is tainted
+fails:String#% supports string formats using %s
+fails:String#% calls to_s on arguments for %s format
+fails:String#% taints result for %s when argument is tainted
+fails:String#% raises an ArgumentError for huge precisions for %s
+fails:String#% supports unsigned formats using %u
+fails:String#% formats negative values with a leading sign using %u
+fails:String#% supports hex formats using %x
+fails:String#% supports hex formats using %X
+fails:String#% doesn't taint the result for %b when argument is tainted
+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#% behaves as if calling Kernel#Float for %e arguments, when the passed argument does not respond to #to_ary
+fails:String#% doesn't taint the result for %e when argument is tainted
+fails:String#% behaves as if calling Kernel#Float for %E arguments, when the passed argument does not respond to #to_ary
+fails:String#% doesn't taint the result for %E when argument is tainted
+fails:String#% behaves as if calling Kernel#Float for %f arguments, when the passed argument does not respond to #to_ary
+fails:String#% doesn't taint the result for %f when argument is tainted
+fails:String#% behaves as if calling Kernel#Float for %g arguments, when the passed argument does not respond to #to_ary
+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
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/multiply_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/multiply_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/multiply_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,2 @@
+fails:String#* returns subclass instances
+fails:String#* always taints the result when self is tainted
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/partition_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/partition_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/partition_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1 @@
+critical:String#partition with String converts its argument using :to_str
\ No newline at end of file
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/plus_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/plus_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/plus_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,3 @@
+fails:String#+ converts any non-String argument with #to_str
+fails:String#+ doesn't return subclass instances
+fails:String#+ taints the result when self or other is tainted
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/replace_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/replace_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/replace_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,3 @@
+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
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/reverse_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/reverse_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/reverse_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1 @@
+fails:String#reverse! raises a TypeError if self is frozen
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/rindex_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/rindex_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/rindex_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,13 @@
+fails:String#rindex with object raises a TypeError if obj isn't a String, Fixnum or Regexp
+fails:String#rindex with object tries to convert obj to a string via to_str
+fails:String#rindex with Fixnum doesn't use fixnum % 256
+fails:String#rindex with Fixnum returns nil if the character isn't found
+fails:String#rindex with Fixnum tries to convert start_offset to an integer via to_int
+fails:String#rindex with String behaves the same as String#rindex(char) for one-character strings
+fails:String#rindex with String returns the index of the last occurrence of the given substring
+fails:String#rindex with String ignores string subclasses
+fails:String#rindex with String starts the search at the given offset
+fails:String#rindex with String returns nil if the substring isn't found
+fails:String#rindex with String tries to convert start_offset to an integer via to_int
+fails:String#rindex with Regexp behaves the same as String#rindex(string) for escaped string regexps
+fails:String#rindex with Regexp tries to convert start_offset to an integer via to_int
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/rjust_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/rjust_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/rjust_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,5 @@
+critical:String#rjust with length, padding raises an ArgumentError when padstr is empty
+fails:String#rjust with length, padding returns a new string of specified length with self right justified and padded with padstr
+fails:String#rjust with length, padding tries to convert padstr to a string using to_str
+fails:String#rjust with length, padding raises a TypeError when padstr can't be converted
+fails:String#rjust with length, padding returns subclass instances when called on subclasses
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/rpartition_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/rpartition_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/rpartition_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,3 @@
+critical:String#rpartition with String converts its argument using :to_str
+fails:String#rpartition with String returns an array of substrings based on splitting on the given string
+fails:String#rpartition with String accepts regexp
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/rstrip_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/rstrip_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/rstrip_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,2 @@
+fails:String#rstrip returns a copy of self with trailing whitespace removed
+fails:String#rstrip! raises a TypeError if self is frozen
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/scan_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/scan_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/scan_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,6 @@
+fails:String#scan sets $~ to MatchData of last match and nil when there's none
+fails:String#scan raises a TypeError if pattern isn't a Regexp and can't be converted to a String
+fails:String#scan taints the match strings if self is tainted, unless the taint happens in the method call
+fails:String#scan with pattern and block sets $~ for access from the block
+fails:String#scan with pattern and block sets $~ to MatchData of last match and nil when there's none for access from outside
+fails:String#scan with pattern and block taints the match strings if self is tainted, unless the tain happens inside the scan
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/size_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/size_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/size_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1 @@
+critical:String#size calls to_int on index
\ No newline at end of file
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/slice_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/slice_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/slice_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,28 @@
+critical:String#slice! with index calls to_int on index
+fails:String#slice! with index raises a TypeError if self is frozen
+fails:String#slice! with index doesn't raise a TypeError if self is frozen and idx is outside of self
+fails:String#slice! with index, length deletes and returns the substring at idx and the given length
+fails:String#slice! with index, length returns nil if the length is negative
+fails:String#slice! with index, length raises a TypeError if self is frozen
+fails:String#slice! with index, length doesn't raise a TypeError if self is frozen but the given position is out of self
+fails:String#slice! with index, length doesn't raise a TypeError if self is frozen but length is negative
+fails:String#slice! with index, length calls to_int on idx and length
+fails:String#slice! with index, length returns subclass instances
+fails:String#slice! Range returns subclass instances
+fails:String#slice! Range calls to_int on range arguments
+fails:String#slice! Range works with Range subclasses
+fails:String#slice! Range raises a TypeError if self is frozen
+fails:String#slice! Range doesn't raise a TypeError if self is frozen but the given range is out of self
+fails:String#slice! with Regexp doesn't taint self when regexp is tainted
+fails:String#slice! with Regexp returns subclass instances
+fails:String#slice! with Regexp raises a TypeError if self is frozen
+fails:String#slice! with Regexp doesn't raise a TypeError if self is frozen but there is no match
+fails:String#slice! with Regexp, index doesn't taint self when regexp is tainted
+fails:String#slice! with Regexp, index calls to_int on idx
+fails:String#slice! with Regexp, index returns subclass instances
+fails:String#slice! with Regexp, index raises a TypeError if self is frozen
+fails:String#slice! with Regexp, index doesn't raise a TypeError if self is frozen but there is no match
+fails:String#slice! with Regexp, index doesn't raise a TypeError if self is frozen but there is no capture for idx
+fails:String#slice! with String returns a subclass instance when given a subclass instance
+fails:String#slice! with String raises a TypeError if self is frozen
+fails:String#slice! with String doesn't raise a TypeError if self is frozen but self does not contain other
\ No newline at end of file
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/split_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/split_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/split_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,10 @@
+critical:String#split with String defaults to $; when string isn't given or nil
+critical:String#split with Regexp defaults to $; when regexp isn't given or nil
+fails:String#split with String ignores leading and continuous whitespace when string is a single space
+fails:String#split with String splits between characters when its argument is an empty string
+fails:String#split with String returns subclass instances based on self
+fails:String#split with String does not call constructor on created subclass instances
+fails:String#split with String taints the resulting strings if self is tainted
+fails:String#split with Regexp returns subclass instances based on self
+fails:String#split with Regexp does not call constructor on created subclass instances
+fails:String#split with Regexp taints the resulting strings if self is tainted
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/squeeze_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/squeeze_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/squeeze_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,6 @@
+fails:String#squeeze negates sets starting with ^
+fails:String#squeeze squeezes all chars in a sequence
+fails:String#squeeze taints the result when self is tainted
+fails:String#squeeze raises a TypeError when one set arg can't be converted to a string
+fails:String#squeeze returns subclass instances when called on a subclass
+fails:String#squeeze! raises a TypeError when self is frozen
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/start_with_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/start_with_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/start_with_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1 @@
+fails:String#start_with? works for multibyte strings
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/strip_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/strip_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/strip_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,2 @@
+fails:String#strip returns a new string with leading and trailing whitespace removed
+fails:String#strip! raises a TypeError if self is frozen
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/sub_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/sub_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/sub_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,12 @@
+fails:String#sub with pattern, replacement doesn't interpret regexp metacharacters if pattern is a string
+fails:String#sub with pattern, replacement taints the result if the original string or replacement is tainted
+fails:String#sub with pattern, replacement tries to convert pattern to a string using to_str
+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, replacement returns subclass instances when called on a subclass
+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 taints the result if the original string or replacement is tainted
+fails:String#sub! with pattern, replacement taints self if replacement is tainted
+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
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/to_a_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/to_a_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/to_a_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,2 @@
+fails:String#to_a returns an empty array for empty strings
+fails:String#to_a returns an array containing the string for non-empty strings
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/to_i_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/to_i_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/to_i_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,2 @@
+fails:String#to_i ignores leading underscores
+fails:String#to_i ignores a leading mix of whitespaces and underscores
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/tr_s_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/tr_s_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/tr_s_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,5 @@
+fails:String#tr_s accepts c1-c2 notation to denote ranges of characters
+fails:String#tr_s translates chars not in from_string when it starts with a ^
+fails:String#tr_s returns subclass instances when called on a subclass
+fails:String#tr_s taints the result when self is tainted
+fails:String#tr_s! raises a TypeError if self is frozen
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/tr_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/tr_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/tr_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,7 @@
+fails:String#tr accepts c1-c2 notation to denote ranges of characters
+fails:String#tr pads to_str with its last char if it is shorter than from_string
+fails:String#tr translates chars not in from_string when it starts with a ^
+fails:String#tr returns subclass instances when called on a subclass
+fails:String#tr taints the result when self is tainted
+fails:String#tr! modifies self in place
+fails:String#tr! raises a TypeError if self is frozen
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/unpack_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/unpack_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/unpack_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,2 @@
+fails:String#unpack with 'DdEeFfGg' directives returns an array by decoding self in little-endian order according to the format string
+fails:String#unpack with 'm' directive returns an array by decoding self according to the format string
Added: MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/upto_tags.txt
===================================================================
--- MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/upto_tags.txt (rev 0)
+++ MacRuby/branches/experimental/spec/frozen/tags/macruby/core/string/upto_tags.txt 2009-05-31 23:34:49 UTC (rev 1685)
@@ -0,0 +1,2 @@
+fails:String#upto works with symbols to
+fails:String#upto returns an enumerator when no block given
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090531/a13e523b/attachment-0001.html>
More information about the macruby-changes
mailing list