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-3.0.2/spec/ruby/library/stringscanner/shared/matched_size.rb
describe :strscan_matched_size, shared: true do
  before :each do
    @s = StringScanner.new("This is a test")
  end

  it "returns the size of the most recent match" do
    @s.check(/This/)
    @s.send(@method).should == 4
    @s.send(@method).should == 4
    @s.scan(//)
    @s.send(@method).should == 0
  end

  it "returns nil if there was no recent match" do
    @s.send(@method).should == nil
    @s.check(/\d+/)
    @s.send(@method).should == nil
    @s.terminate
    @s.send(@method).should == nil
  end
end