Skip to content
This repository was archived by the owner on May 5, 2019. It is now read-only.

Commit d49f76b

Browse files
cjprybolararslan
authored andcommitted
replace printtable test (#29)
* don't bundle with my other PR * use sprint to test output * try and account for different line endings when hashing * fix tests * hashing
1 parent 7725207 commit d49f76b

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/abstractdatatable/io.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function printtable(io::IO,
4242
quotestr = string(quotemark)
4343
for i in 1:n
4444
for j in 1:p
45-
if !isnull(dt[j],i)
45+
if !isnull(dt[j][i])
4646
if ! (etypes[j] <: Real)
4747
print(io, quotemark)
4848
escapedprint(io, get(dt[i, j]), quotestr)

test/io.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module TestIO
22
using Base.Test
33
using DataTables
44
using LaTeXStrings
5+
using NullableArrays
6+
using CategoricalArrays
57

68
# Test LaTeX export
79
dt = DataTable(A = 1:4,
@@ -38,4 +40,14 @@ module TestIO
3840
show(io, "text/html", dt)
3941
@test length(String(take!(io))) < 10000
4042

43+
dt = DataTable(A = 1:26,
44+
B = 'a':'z',
45+
C = [string(x) for x='A':'Z'],
46+
D = CategoricalArray([string(x) for x='A':'Z']),
47+
E = NullableArray(rand(26)),
48+
F = NullableArray(fill(Nullable(), 26)),
49+
G = fill(Nullable(), 26))
50+
51+
answer = Sys.WORD_SIZE == 64 ? 0xde54e70f51205910 : 0x340524cd
52+
@test hash(sprint(printtable, dt)) == answer
4153
end

0 commit comments

Comments
 (0)