1
1
using JSON
2
2
using Test
3
3
using Distributed: RemoteChannel
4
+ using Sockets
4
5
5
6
@isdefined (a) || include (" json-samples.jl" )
6
7
7
8
finished_async_tests = RemoteChannel ()
8
9
9
- using Sockets
10
-
11
- let serv = listen (7777 )
12
- @async let s; try
13
- s = accept (serv)
14
- close (serv)
15
- @test JSON. parse (s) != nothing # a
16
- @test JSON. parse (s) != nothing # b
17
- validate_c (s) # c
18
- @test JSON. parse (s) != nothing # d
19
- validate_svg_tviewer_menu (s) # svg_tviewer_menu
20
- @test JSON. parse (s) != nothing # gmaps
21
- @test JSON. parse (s) != nothing # colors1
22
- @test JSON. parse (s) != nothing # colors2
23
- @test JSON. parse (s) != nothing # colors3
24
- @test JSON. parse (s) != nothing # twitter
25
- @test JSON. parse (s) != nothing # facebook
26
- validate_flickr (s) # flickr
27
- @test JSON. parse (s) != nothing # youtube
28
- @test JSON. parse (s) != nothing # iphone
29
- @test JSON. parse (s) != nothing # customer
30
- @test JSON. parse (s) != nothing # product
31
- @test JSON. parse (s) != nothing # interop
32
- validate_unicode (s) # unicode
33
- @test JSON. parse (s) != nothing # issue5
34
- @test JSON. parse (s) != nothing # dollars
35
- @test JSON. parse (s) != nothing # brackets
36
-
37
- put! (finished_async_tests, nothing )
38
- catch ex
39
- @error " async test failure" _exception= ex
40
- finally
41
- @isdefined (s) && close (s)
42
- close (serv)
43
- end ; end
44
- end
45
-
46
- w = connect (Sockets. localhost, 7777 )
47
-
48
- @test JSON. parse (a) != nothing
10
+ port, serv = listenany (7777 )
11
+ @async let s; try
12
+ s = accept (serv)
13
+ close (serv)
14
+ @test JSON. parse (s) != = nothing # a
15
+ @test JSON. parse (s) != = nothing # b
16
+ validate_c (s) # c
17
+ @test JSON. parse (s) != = nothing # d
18
+ validate_svg_tviewer_menu (s) # svg_tviewer_menu
19
+ @test JSON. parse (s) != = nothing # gmaps
20
+ @test JSON. parse (s) != = nothing # colors1
21
+ @test JSON. parse (s) != = nothing # colors2
22
+ @test JSON. parse (s) != = nothing # colors3
23
+ @test JSON. parse (s) != = nothing # twitter
24
+ @test JSON. parse (s) != = nothing # facebook
25
+ validate_flickr (s) # flickr
26
+ @test JSON. parse (s) != = nothing # youtube
27
+ @test JSON. parse (s) != = nothing # iphone
28
+ @test JSON. parse (s) != = nothing # customer
29
+ @test JSON. parse (s) != = nothing # product
30
+ @test JSON. parse (s) != = nothing # interop
31
+ validate_unicode (s) # unicode
32
+ @test JSON. parse (s) != = nothing # issue5
33
+ @test JSON. parse (s) != = nothing # dollars
34
+ @test JSON. parse (s) != = nothing # brackets
35
+
36
+ put! (finished_async_tests, nothing )
37
+ catch ex
38
+ @error " async test failure" _exception= ex
39
+ finally
40
+ @isdefined (s) && close (s)
41
+ close (serv)
42
+ end ; end
43
+
44
+ w = connect (Sockets. localhost, port)
45
+
46
+ @test JSON. parse (a) != = nothing
49
47
write (w, a)
50
48
51
- @test JSON. parse (b) != nothing
49
+ @test JSON. parse (b) != = nothing
52
50
write (w, b)
53
51
54
52
validate_c (c)
55
53
write (w, c)
56
54
57
- @test JSON. parse (d) != nothing
55
+ @test JSON. parse (d) != = nothing
58
56
write (w, d)
59
57
60
58
validate_svg_tviewer_menu (svg_tviewer_menu)
61
59
write (w, svg_tviewer_menu)
62
60
63
- @test JSON. parse (gmaps) != nothing
61
+ @test JSON. parse (gmaps) != = nothing
64
62
write (w, gmaps)
65
63
66
- @test JSON. parse (colors1) != nothing
64
+ @test JSON. parse (colors1) != = nothing
67
65
write (w, colors1)
68
66
69
- @test JSON. parse (colors2) != nothing
67
+ @test JSON. parse (colors2) != = nothing
70
68
write (w, colors2)
71
69
72
- @test JSON. parse (colors3) != nothing
70
+ @test JSON. parse (colors3) != = nothing
73
71
write (w, colors3)
74
72
75
- @test JSON. parse (twitter) != nothing
73
+ @test JSON. parse (twitter) != = nothing
76
74
write (w, twitter)
77
75
78
- @test JSON. parse (facebook) != nothing
76
+ @test JSON. parse (facebook) != = nothing
79
77
write (w, facebook)
80
78
81
79
validate_flickr (flickr)
82
80
write (w, flickr)
83
81
84
- @test JSON. parse (youtube) != nothing
82
+ @test JSON. parse (youtube) != = nothing
85
83
write (w, youtube)
86
84
87
- @test JSON. parse (iphone) != nothing
85
+ @test JSON. parse (iphone) != = nothing
88
86
write (w, iphone)
89
87
90
- @test JSON. parse (customer) != nothing
88
+ @test JSON. parse (customer) != = nothing
91
89
write (w, customer)
92
90
93
- @test JSON. parse (product) != nothing
91
+ @test JSON. parse (product) != = nothing
94
92
write (w, product)
95
93
96
- @test JSON. parse (interop) != nothing
94
+ @test JSON. parse (interop) != = nothing
97
95
write (w, interop)
98
96
99
97
validate_unicode (unicode)
@@ -107,13 +105,13 @@ write(w, issue5)
107
105
# $ escaping issue
108
106
dollars = [" all of the \$ s" , " µniçø∂\$ " ]
109
107
json_dollars = json (dollars)
110
- @test JSON. parse (json_dollars) != nothing
108
+ @test JSON. parse (json_dollars) != = nothing
111
109
write (w, json_dollars)
112
110
113
111
# unmatched brackets
114
112
brackets = Dict (" foo" => " ba}r" , " be}e]p" => " boo{p" )
115
113
json_brackets = json (brackets)
116
- @test JSON. parse (json_brackets) != nothing
114
+ @test JSON. parse (json_brackets) != = nothing
117
115
write (w, json_dollars)
118
116
119
117
fetch (finished_async_tests)
0 commit comments