Skip to content

Commit

Permalink
Fix tests on 0.6 (#185)
Browse files Browse the repository at this point in the history
* Array constructor changes

* Repair type lowering test
  • Loading branch information
TotalVerb authored Jan 21, 2017
1 parent efaafb7 commit 34dcf31
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/JSON.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import .Parser.parse
"Internal JSON.jl implementation detail; do not depend on this type."
immutable AssociativeWrapper{T} <: Associative{Symbol, Any}
wrapped::T
fns::Array{Symbol, 1}
fns::Vector{Symbol}
end
AssociativeWrapper(x) = AssociativeWrapper(x, fieldnames(x))

Expand Down Expand Up @@ -58,7 +58,7 @@ if VERSION < v"0.5.0-dev+2396"
end

lower(c::Char) = string(c)
lower(d::DataType) = string(d)
lower(d::Type) = string(d)
lower(m::Module) = throw(ArgumentError("cannot serialize Module $m as JSON"))
lower(x::Real) = Float64(x)

Expand All @@ -69,7 +69,7 @@ type State{I}
indentstep::Int
indentlen::Int
prefix::AbstractString
otype::Array{Bool, 1}
otype::Vector{Bool}
State(indentstep::Int) = new(indentstep,
0,
"",
Expand Down
2 changes: 1 addition & 1 deletion src/bytes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const ESCAPES = Dict(
LATIN_T => TAB)

const REVERSE_ESCAPES = Dict(map(reverse, ESCAPES))
const ESCAPED_ARRAY = Array(Vector{UInt8}, 256)
const ESCAPED_ARRAY = Vector{Vector{UInt8}}(256)
for c in 0x00:0xFF
ESCAPED_ARRAY[c + 1] = if c == SOLIDUS
[SOLIDUS] # don't escape this one
Expand Down
2 changes: 1 addition & 1 deletion src/specialized.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function parse_string(ps::MemoryParserState)
fastpath, len = predict_string(ps)

# Now read the string itself
b = Array{UInt8, 1}(len)
b = Vector{UInt8}(len)

# Fast path occurs when the string has no escaped characters. This is quite
# often the case in real-world data, especially when keys are short strings.
Expand Down
2 changes: 1 addition & 1 deletion test/lowering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ immutable Type151{T}
x::T
end

@test JSON.json(Type151) == "\"Type151{T}\""
@test JSON.parse(JSON.json(Type151)) == string(Type151)

JSON.lower{T}(v::Type151{T}) = Dict(:type => T, :value => v.x)
@test JSON.parse(JSON.json(Type151(1.0))) == Dict(
Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ validate_e(e) = begin
@test typeof(j["menu"]) == Dict{Compat.UTF8String, Any}
@test length(j["menu"]) == 2
@test j["menu"]["header"] == "SVG\tViewerα"
@test isa(j["menu"]["items"], Array)
@test isa(j["menu"]["items"], Vector{Any})
@test length(j["menu"]["items"]) == 22
@test j["menu"]["items"][3] == nothing
@test j["menu"]["items"][2]["id"] == "OpenNew"
Expand Down Expand Up @@ -184,7 +184,7 @@ obj = JSON.parse("{\"a\":2e10}")

#test for issue 21
a=JSON.parse(test21)
@test isa(a, Array{Any})
@test isa(a, Vector{Any})
@test length(a) == 2
#Multidimensional arrays
@test json([0 1; 2 0]) == "[[0,2],[1,0]]"
Expand Down

0 comments on commit 34dcf31

Please sign in to comment.