HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/src/ruby-2.7.4/spec/ruby/library/stringscanner/shared/extract_range.rb
describe :extract_range, shared: true do
  it "returns an instance of String when passed a String subclass" do
    cls = Class.new(String)
    sub = cls.new("abc")

    s = StringScanner.new(sub)
    ch = s.send(@method)
    ch.should_not be_kind_of(cls)
    ch.should be_an_instance_of(String)
  end

  ruby_version_is ''...'2.7' do
    it "taints the returned String if the input was tainted" do
      str = 'abc'
      str.taint

      s = StringScanner.new(str)

      s.send(@method).tainted?.should be_true
      s.send(@method).tainted?.should be_true
      s.send(@method).tainted?.should be_true
    end
  end
end