From f6846edfb1eb4da1346756a7a73cd36b4fb2b4a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n=20O=27Mara?= Date: Sat, 21 Mar 2020 17:16:14 +1100 Subject: [PATCH] Check header in roundtrip --- test/runtests.jl | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 10ca2d0..30f6914 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -172,15 +172,27 @@ end mktemp() do path, io # copy reader = open(SAM.Reader, filepath) - writer = SAM.Writer(io, header(reader)) + + header_original = header(reader) + + writer = SAM.Writer(io, header_original) + records = SAM.Record[] for record in reader push!(records, record) write(writer, record) end + close(reader) close(writer) - @test compare_records(open(collect, SAM.Reader, path), records) + + reader = open(SAM.Reader, path) + + @test header(reader) == header_original + @test compare_records(collect(reader), records) + + close(reader) + end end end @@ -378,8 +390,11 @@ end else reader = open(BAM.Reader, filepath) end - writer = BAM.Writer( - BGZFStream(path, "w"), BAM.header(reader, fillSQ=isempty(findall(header(reader), "SQ")))) + + header_original = header(reader) + + writer = BAM.Writer(BGZFStream(path, "w"), BAM.header(reader, fillSQ=isempty(findall(header(reader), "SQ")))) + records = BAM.Record[] for record in reader push!(records, record) @@ -387,7 +402,14 @@ end end close(reader) close(writer) - @test compare_records(open(collect, BAM.Reader, path), records) + + reader = open(BAM.Reader, path) + + @test header(reader) == header_original + @test compare_records(collect(reader), records) + + close(reader) + end end end