Sha256: 537b97b09466ae0a54ab6b5db556c604dfda1ae2a354490fe169de3ce0fc306f

Contents?: true

Size: 568 Bytes

Versions: 7

Compression:

Stored size: 568 Bytes

Contents

require "stringio"

describe "StringIO#lineno" do
  before(:each) do
    @io = StringIO.new("this\nis\nan\nexample")
  end

  it "returns the number of lines read" do
    @io.gets
    @io.gets
    @io.gets
    @io.lineno.should eql(3)
  end
end

describe "StringIO#lineno=" do
  before(:each) do
    @io = StringIO.new("this\nis\nan\nexample")
  end

  it "sets the current line number, but has no impact on the position" do
    @io.lineno = 3
    @io.pos.should eql(0)

    @io.gets.should == "this\n"
    @io.lineno.should eql(4)
    @io.pos.should eql(5)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubysl-stringio-2.3 spec/lineno_spec.rb
rubysl-stringio-2.2 spec/lineno_spec.rb
rubysl-stringio-2.1 spec/lineno_spec.rb
rubysl-stringio-2.1.0 spec/lineno_spec.rb
rubysl-stringio-1.0.1 spec/lineno_spec.rb
rubysl-stringio-1.0.0 spec/lineno_spec.rb
rubysl-stringio-2.0.0 spec/lineno_spec.rb