Skip to content

Commit

Permalink
Merge branch 'hotfix/write'
Browse files Browse the repository at this point in the history
  • Loading branch information
CiaranOMara committed Dec 15, 2019
2 parents 242392d + 7432dc0 commit 61d9d5e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Bedgraph"
uuid = "0bcc2ff6-69eb-520d-bede-0374fc5bd2fd"
authors = ["Ciarán O'Mara <[email protected]>"]
version = "1.2.0"
version = "1.2.1"

[compat]
julia = "0.7, 1"
Expand Down
2 changes: 1 addition & 1 deletion src/writer.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"Write [`Record`](@ref)s to `IO` as string."
function Base.write(io::IO, records::Union{Vector{Record}, <:AbstractVector{Record}}) #Note: catching non-isbits arrays and we assume the indexes have been bumpped and the open ends are correct.
function Base.write(io::IO, records::Vector{Record}) #Note: catching non-isbits arrays and we assume the indexes have been bumpped and the open ends are correct.
for record in records
Base.write(io, record, '\n')
end
Expand Down
23 changes: 19 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,36 @@ end
@test_nowarn mktemp() do path, io
header = Bedgraph.generateBasicHeader(Bag.records)
write(io, header, Bag.records)
# @test readstring(Bag.file) == readstring(outputfile) # differnces in float representation, but otherwise hold the same information.
#TODO: explicitly test that Bag.files hold the same information.

seekstart(io)
@test Bag.records == read(io, Vector{Record})
end

# Not able to capture write(::IO, ::AbstractVector).
# @test_nowarn mktemp() do path, io
# # test AbstractVector
# records = view(Bag.records, 2:4)
# header = Bedgraph.generateBasicHeader(records)
# write(io, header, records)
#
# seekstart(io)
# @test records == read(io, Vector{Record})
# end

@test_nowarn mktemp() do path, io
header = Bedgraph.generateBasicHeader("chr19", Bag.records[1].first, Bag.records[end].last, bump_forward=false)
write(io, header, Bag.records)
# @test readstring(Bag.file) == readstring(outputfile) # differnces in float representation, but otherwise hold the same information.
#TODO: explicitly test that Bag.files hold the same information.

seekstart(io)
@test Bag.records == read(io, Vector{Record})
end

@test_nowarn mktempdir() do path
outputfile = joinpath(path, "test.bedgraph")
header = Bedgraph.generateBasicHeader(Bag.records)
write(outputfile, header, Bag.records)

@test Bag.records == read(outputfile, Vector{Record})
end

end #testset I/O
Expand Down

2 comments on commit 61d9d5e

@CiaranOMara
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/6740

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v1.2.1 -m "<description of version>" 61d9d5e7728adf84c624365978a4e2a302ba00b9
git push origin v1.2.1

Please sign in to comment.