Sha256: 1c696423ff2d46695b735b0f7c7e61ef8d239c95a92c1cc02e4372f2fdd764ae
Contents?: true
Size: 1.12 KB
Versions: 83
Compression:
Stored size: 1.12 KB
Contents
# encoding: utf-8 require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../spec_helper' require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/fixtures/classes' ruby_version_is '1.8.7' do describe "IO#chars" do before :each do @original = $KCODE $KCODE = "UTF-8" @io = File.open(IOSpecs.gets_fixtures) end after :each do @io.close unless @io.closed? $KCODE = @original end it "returns an enumerator of the next chars from the stream" do enum = @io.chars enum.should be_kind_of(enumerator_class) @io.readline.should == "Voici la ligne une.\n" enum.first(5).should == ["Q", "u", "i", " ", "รจ"] end ruby_version_is '1.9' do it "ignores a block" do @io.chars{ raise "oups" }.should be_kind_of(enumerator_class) end end it "raises IOError on closed stream" do enum = IOSpecs.closed_file.chars lambda { enum.first }.should raise_error(IOError) enum = @io.chars enum.first.should == "V" @io.close lambda { enum.first }.should raise_error(IOError) end end end
Version data entries
83 entries across 83 versions & 1 rubygems