Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue in CSV.write for empty strings; fixes #515 #516

Merged
merged 5 commits into from
Oct 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
before_install:
- cd ../..
- mv $TRAVIS_REPO_SLUG _old
- git config --global core.autocrlf false
- git clone --depth=50 _old $TRAVIS_REPO_SLUG
- cd $TRAVIS_REPO_SLUG

language: julia

sudo: false
Expand All @@ -13,7 +20,6 @@ arch:

julia:
- 1.0
- 1.2
- 1.3
- nightly

Expand All @@ -31,12 +37,12 @@ notifications:
email: false

after_success:
- julia -e 'ENV["TRAVIS_JULIA_VERSION"] != "1.1" && ENV["TRAVIS_OS_NAME"] != "linux" && exit(); using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'
- julia -e 'ENV["TRAVIS_JULIA_VERSION"] == "1.3" && ENV["TRAVIS_OS_NAME"] != "linux" && exit(); using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())'

jobs:
include:
- stage: "Documentation"
julia: 1.2
julia: 1.3
os: linux
script:
- julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate(); Pkg.build("CSV")'
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "CodecZlib"]
test = ["Test", "Random", "CodecZlib"]
1 change: 1 addition & 0 deletions src/write.jl
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ function writecell(buf, pos, len, io, x::AbstractString, opts)
end

function check(bytes, sz, delim::UInt8, oq, cq, newline::UInt8)
isempty(bytes) && return false, false
needtoescape = false
@inbounds needtoquote = bytes[1] == oq
@simd for i = 1:sz
Expand Down
8 changes: 7 additions & 1 deletion test/write.jl
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,10 @@ using CSV, Dates, WeakRefStrings, CategoricalArrays, Tables
end

@test read(rd, String) == "col1,col2,col3\n1,4,7\n2,5,8\n3,6,9\n"
end

# issue 515
io = IOBuffer()
(col1=[""],) |> CSV.write(io)
@test String(take!(io)) == "col1\n\n"

end # @testset "CSV.write"