diff options
Diffstat (limited to 'spec/ruby/core/string/scan_spec.rb')
-rw-r--r-- | spec/ruby/core/string/scan_spec.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/spec/ruby/core/string/scan_spec.rb b/spec/ruby/core/string/scan_spec.rb index ab73f5747b..70c3b7fb7b 100644 --- a/spec/ruby/core/string/scan_spec.rb +++ b/spec/ruby/core/string/scan_spec.rb @@ -69,6 +69,12 @@ describe "String#scan" do it "does not raise any errors when passed a multi-byte string" do "あああaaaあああ".scan("あああ").should == ["あああ", "あああ"] end + + it "returns Strings in the same encoding as self" do + "cruel world".encode("US-ASCII").scan(/\w+/).each do |s| + s.encoding.should == Encoding::US_ASCII + end + end end describe "String#scan with pattern and block" do @@ -159,11 +165,9 @@ describe "String#scan with pattern and block" do end end - ruby_version_is '3.0' do - it "yields String instances for subclasses" do - a = [] - StringSpecs::MyString.new("abc").scan(/./) { |s| a << s.class } - a.should == [String, String, String] - end + it "yields String instances for subclasses" do + a = [] + StringSpecs::MyString.new("abc").scan(/./) { |s| a << s.class } + a.should == [String, String, String] end end |