Skip to content

Commit ce15adb

Browse files
committed
Fiex bug where dicts where not recursive.
1 parent 0273d97 commit ce15adb

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "MathLink"
22
uuid = "18c93696-a329-5786-9845-8443133fa0b4"
3-
version = "0.5.2"
3+
version = "0.5.3"
44

55
[deps]
66
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"

src/W2Julia.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
export W2Julia
44

55
W2Julia(X::Number) = X
6+
W2Julia(X::String) = X
67
W2Julia(X::MathLink.WSymbol) = X
78
function W2Julia(X::MathLink.WExpr)
89
if X.head == W"List"
9-
return [W2Julia(x) for x in X.args]
10+
return W2Julia.(X.args)
1011
elseif X.head == W"Association"
1112
W2JuliaAccociation(X)
1213
else
@@ -31,7 +32,7 @@ function W2JuliaAccociation(Asso::MathLink.WExpr)
3132
if length(Rule.args) != 2
3233
error("Bad rule")
3334
end
34-
D[Rule.args[1]]=Rule.args[2]
35+
D[Rule.args[1]]=W2Julia(Rule.args[2])
3536
end
3637
return D
3738
end

test/runtests.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ import MathLink: WExpr, WSymbol
1515
@testset "Association to Dict" begin
1616
@test W2Julia(W`Association["team" -> "HOU", "lastName" -> "Ching"]`) == Dict( "team" => "HOU" , "lastName" => "Ching")
1717
end
18+
@testset "Association and List Dict" begin
19+
@test W2Julia(W`Association["team" -> {1,2,3}, "lastName" -> "Ching"]`) == Dict( "team" => [1,2,3] , "lastName" => "Ching")
20+
@test W2Julia(W`{1,Association["team" -> {1,2,3}, "lastName" -> "Ching"]}`) == [1,Dict( "team" => [1,2,3] , "lastName" => "Ching")]
21+
22+
end
23+
1824
end
1925

2026

0 commit comments

Comments
 (0)