Add unit test for IO.binread with :all option
Unit test checks correct handling of 0x0D0A (CR+LF) when reading entire binary file Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
This commit is contained in:
committed by
José Valim
parent
18a5d8affb
commit
b4fc2b35fc
@@ -0,0 +1,4 @@
|
||||
LF
|
||||
CR␍CRLF
|
||||
LFCR
|
||||
␍
|
||||
@@ -22,6 +22,12 @@ defmodule IOTest do
|
||||
assert File.close(file) == :ok
|
||||
end
|
||||
|
||||
test :binread_all do
|
||||
{:ok, file} = File.open(Path.expand('fixtures/file.bin', __DIR__))
|
||||
assert "LF\nCR\rCRLF\r\nLFCR\n\r" == IO.binread(file, :all)
|
||||
assert File.close(file) == :ok
|
||||
end
|
||||
|
||||
test :getn do
|
||||
{:ok, file} = File.open(Path.expand('fixtures/file.txt', __DIR__))
|
||||
assert "F" == IO.getn(file, "")
|
||||
|
||||
Reference in New Issue
Block a user