Sha256: 11d0907e65763f933928ed149252e280adbb2c8e7c4eabf48a975b379cda02aa
Contents?: true
Size: 1.07 KB
Versions: 83
Compression:
Stored size: 1.07 KB
Contents
require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../spec_helper' describe "ARGF.lineno" do before :each do @file1 = fixture File.join(__rhoGetCurrentDir(), __FILE__), "file1.txt" @file2 = fixture File.join(__rhoGetCurrentDir(), __FILE__), "file2.txt" end after :each do ARGF.close end # NOTE: this test assumes that fixtures files have two lines each # TODO: break this into four specs it "returns the current line number on each file" do argv [@file1, @file2, @file1, @file2] do ARGF.gets ARGF.lineno.should == 1 ARGF.gets ARGF.lineno.should == 2 ARGF.gets ARGF.lineno.should == 3 ARGF.gets ARGF.lineno.should == 4 ARGF.rewind ARGF.lineno.should == 4 ARGF.gets ARGF.lineno.should == 3 ARGF.lineno = 1000 $..should == 1000 ARGF.gets $..should == 1001 ARGF.gets $..should == 1002 $. = 2000 ARGF.gets $..should == 2001 ARGF.gets $..should == 2002 ARGF.read $..should == 2002 end end end
Version data entries
83 entries across 83 versions & 1 rubygems