test/bzip2_writer_test.rb in iostreams-1.10.2 vs test/bzip2_writer_test.rb in iostreams-1.10.3
- old
+ new
@@ -18,14 +18,17 @@
temp_file.delete
end
describe ".file" do
it "file" do
- IOStreams::Bzip2::Writer.file(file_name) do |io|
- io.write(decompressed)
- io.write(decompressed)
- end
+ result =
+ IOStreams::Bzip2::Writer.file(file_name) do |io|
+ io.write(decompressed)
+ io.write(decompressed)
+ 53534
+ end
+ assert_equal 53534, result
File.open(file_name, "rb") do |file|
io = ::Bzip2::FFI::Reader.new(file)
result = io.read
temp_file.delete
@@ -33,13 +36,16 @@
end
end
it "stream" do
io_string = StringIO.new("".b)
- IOStreams::Bzip2::Writer.stream(io_string) do |io|
- io.write(decompressed)
- io.write(decompressed)
- end
+ result =
+ IOStreams::Bzip2::Writer.stream(io_string) do |io|
+ io.write(decompressed)
+ io.write(decompressed)
+ 53534
+ end
+ assert_equal 53534, result
io = StringIO.new(io_string.string)
rbzip2 = ::Bzip2::FFI::Reader.new(io)
data = rbzip2.read
assert_equal decompressed + decompressed, data