summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/index_spec.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-04-28 23:20:11 +0200
committerBenoit Daloze <eregontp@gmail.com>2019-04-28 23:20:11 +0200
commit79671ec57e59091260a0bc3d40a31d31d9c72a94 (patch)
tree2f59a8727b8f63f9e79d50352fa4f78a7cc00234 /spec/ruby/core/string/index_spec.rb
parent994833085ae06afbe94d30ab183d80e0234fbe14 (diff)
Update to ruby/spec@7de852d
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