blob: c620a1a68683f297633356967090d8793aaeb612 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
require_relative '../../spec_helper'
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
|