Sha256: eaa0ce3f45014cdf147674a885dcbc7c2ae4bd8a60e0c29c2b29e496762b1378

Contents?: true

Size: 777 Bytes

Versions: 1

Compression:

Stored size: 777 Bytes

Contents

# encoding: utf-8
require 'jldrill/model/moji/Kana'
require 'jldrill/model/Config'

module JLDrill

	describe KanaFile do
	
		it "should be able to read the file in chunks" do
			kf = KanaFile.new
			kf.lines.size.should be(0)
			kf.file = (File.join(Config::DATA_DIR, "tests/kana.dat"))
			kf.readLines
            kf.encoding.should eql(Kconv::UTF8)
			kf.lines.size.should be(100)
			# Not EOF yet
			kf.parseChunk(10).should eql(false)
			kf.fraction.should eql(0.10)
			kf.parseChunk(10).should eql(false)
			kf.fraction.should eql(0.20)
			# Read to the EOF
			kf.parseChunk(1000).should eql(true)

			# It should dispose of the unparsed lines after parsing
			kf.fraction.should eql(0.0)
			kf.lines.should eql([])

			kf.kanaList.size.should eql(100)
		end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jldrill-0.6.0.1 spec/jldrill/model/Kana_spec.rb