Skip to content

Commit

Permalink
Capitalise module name as per JuliaLang#1537. Removed prefix from exp…
Browse files Browse the repository at this point in the history
…orted method name, since it is namespaced via the module.
  • Loading branch information
aviks committed Nov 14, 2012
1 parent 162b66c commit cf7ee6c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
6 changes: 3 additions & 3 deletions extras/json.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
#Original BSD Licence, (c) 2011, François Glineur


module Json
module JSON

using Base

export parse_json
export parse


function parse_json(strng::String)
function parse(strng::String)

pos::Int = 1
len::Int = length(strng)
Expand Down
39 changes: 19 additions & 20 deletions test/json.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
load("json")
using Json

load("test/json_samples")


@assert parse_json(a) != nothing
@assert parse_json(b) != nothing
@assert parse_json(c) != nothing
@assert parse_json(d) != nothing
@assert JSON.parse(a) != nothing
@assert JSON.parse(b) != nothing
@assert JSON.parse(c) != nothing
@assert JSON.parse(d) != nothing

j=parse_json(e)
j=JSON.parse(e)
@assert j!= nothing
typeof(j) == Dict{String, Any}
@assert length(j) == 1
Expand All @@ -24,27 +23,27 @@ typeof(j["menu"]) == Dict{String, Any}



@assert parse_json(gmaps) != nothing
@assert parse_json(colors1) != nothing
@assert parse_json(colors2) != nothing
@assert parse_json(colors3) != nothing
@assert parse_json(twitter) != nothing
@assert parse_json(facebook) != nothing
@assert JSON.parse(gmaps) != nothing
@assert JSON.parse(colors1) != nothing
@assert JSON.parse(colors2) != nothing
@assert JSON.parse(colors3) != nothing
@assert JSON.parse(twitter) != nothing
@assert JSON.parse(facebook) != nothing

k=parse_json(flickr)
k=JSON.parse(flickr)
@assert k!= nothing
@assert k["totalItems"] == 222
@assert k["items"][1]["description"][12] == '\"'
@assert parse_json(youtube) != nothing
@assert parse_json(iphone) != nothing
@assert parse_json(customer) != nothing
@assert parse_json(product) != nothing
@assert parse_json(interop) != nothing
@assert JSON.parse(youtube) != nothing
@assert JSON.parse(iphone) != nothing
@assert JSON.parse(customer) != nothing
@assert JSON.parse(product) != nothing
@assert JSON.parse(interop) != nothing

u=parse_json(unicode)
u=JSON.parse(unicode)
@assert u!=nothing
@assert u["অলিম্পিকস"]["রেকর্ড"][2]["Marathon"] == "জনি হেইস"

#Uncomment while doing timing tests
#@time for i=1:100 ; parse_json(d) ; end
#@time for i=1:100 ; JSON.parse(d) ; end

0 comments on commit cf7ee6c

Please sign in to comment.