Sha256: 8d1422e264c4c9d02edf63abc82158d352e939690f3b69248757508468970e5d
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
require File.join(File.dirname(__FILE__), '../external_test_helper.rb') require 'external/base' require 'tempfile' class BaseTest < Test::Unit::TestCase include Benchmark include External acts_as_file_test attr_reader :array, :ab, :tempfile def setup @array = ('a'..'z').to_a @tempfile = Tempfile.new("abtest") @tempfile << array.to_s @ab = Base.new(@tempfile) end def teardown tempfile.close unless tempfile.closed? end # # setup tests # def test_setup assert_equal ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"], array assert_equal "abcdefghijklmnopqrstuvwxyz", array.to_s tempfile.pos = 0 assert_equal "abcdefghijklmnopqrstuvwxyz", tempfile.read end # # initialize test # def test_io_points_to_tempfile_when_io_is_nil begin ab = Base.new(nil) assert ab.io != nil assert_equal Tempfile, ab.io.class assert ab.io.path =~ Regexp.new("^" + Dir.tmpdir) ensure ab.close if ab end end # def test_options_are_set_during_initialize # assert_equal 10000, ab.max_gap # assert_equal 1000000, ab.max_chunk_size # # ab = Base.new(nil, :max_gap => 1, :max_chunk_size => 10) # assert_equal 1, ab.max_gap # assert_equal 10, ab.max_chunk_size # end # # close, closed? test # def test_close_closes_io assert !ab.io.closed? ab.close assert ab.io.closed? end def test_closed_returns_closed_state_of_io ab.io.close assert ab.closed? end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
external-0.1.0 | test/external/base_test.rb |