aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/string/index_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/string/index_spec.rb')
-rw-r--r--spec/ruby/core/string/index_spec.rb60
1 files changed, 28 insertions, 32 deletions
diff --git a/spec/ruby/core/string/index_spec.rb b/spec/ruby/core/string/index_spec.rb
index 3ed27034e1..fb5f4e75e7 100644
--- a/spec/ruby/core/string/index_spec.rb
+++ b/spec/ruby/core/string/index_spec.rb
@@ -140,25 +140,23 @@ describe "String#index with String" do
"I’ve got a multibyte character.\n".index("\n\n").should == nil
end
- with_feature :encoding do
- it "returns the character index of a multibyte character" do
- "ありがとう".index("が").should == 2
- end
+ it "returns the character index of a multibyte character" do
+ "ありがとう".index("が").should == 2
+ end
- it "returns the character index after offset" do
- "われわれ".index("わ", 1).should == 2
- end
+ it "returns the character index after offset" do
+ "われわれ".index("わ", 1).should == 2
+ end
- it "returns the character index after a partial first match" do
- "</</h".index("</h").should == 2
- end
+ it "returns the character index after a partial first match" do
+ "</</h".index("</h").should == 2
+ end
- it "raises an Encoding::CompatibilityError if the encodings are incompatible" do
- char = "れ".encode Encoding::EUC_JP
- lambda do
- "あれ".index char
- end.should raise_error(Encoding::CompatibilityError)
- end
+ it "raises an Encoding::CompatibilityError if the encodings are incompatible" do
+ char = "れ".encode Encoding::EUC_JP
+ lambda do
+ "あれ".index char
+ end.should raise_error(Encoding::CompatibilityError)
end
end
@@ -293,24 +291,22 @@ describe "String#index with Regexp" do
"RWOARW".index(/R./, obj).should == 4
end
- with_feature :encoding do
- it "returns the character index of a multibyte character" do
- "ありがとう".index(/が/).should == 2
- end
+ it "returns the character index of a multibyte character" do
+ "ありがとう".index(/が/).should == 2
+ end
- it "returns the character index after offset" do
- "われわれ".index(/わ/, 1).should == 2
- end
+ it "returns the character index after offset" do
+ "われわれ".index(/わ/, 1).should == 2
+ end
- it "treats the offset as a character index" do
- "われわわれ".index(/わ/, 3).should == 3
- end
+ it "treats the offset as a character index" do
+ "われわわれ".index(/わ/, 3).should == 3
+ end
- it "raises an Encoding::CompatibilityError if the encodings are incompatible" do
- re = Regexp.new "れ".encode(Encoding::EUC_JP)
- lambda do
- "あれ".index re
- end.should raise_error(Encoding::CompatibilityError)
- end
+ it "raises an Encoding::CompatibilityError if the encodings are incompatible" do
+ re = Regexp.new "れ".encode(Encoding::EUC_JP)
+ lambda do
+ "あれ".index re
+ end.should raise_error(Encoding::CompatibilityError)
end
end