|
2 | 2 | using Sockets |
3 | 3 | using .TestStructs: Foo, Foo2 |
4 | 4 |
|
5 | | - if Sys.iswindows() |
6 | | - global_socket_name1 = "\\\\.\\pipe\\jsonrpc-testrun1" |
7 | | - elseif Sys.isunix() |
8 | | - global_socket_name1 = joinpath(tempdir(), "jsonrpc-testrun1") |
9 | | - else |
10 | | - error("Unknown operating system.") |
11 | | - end |
| 5 | + global_socket_name1 = JSONRPC.generate_pipe_name() |
12 | 6 |
|
13 | 7 | request1_type = JSONRPC.RequestType("request1", Foo, String) |
14 | 8 | request2_type = JSONRPC.RequestType("request2", Nothing, String) |
|
65 | 59 |
|
66 | 60 | # Now we test a faulty server |
67 | 61 |
|
68 | | - if Sys.iswindows() |
69 | | - global_socket_name2 = "\\\\.\\pipe\\jsonrpc-testrun2" |
70 | | - elseif Sys.isunix() |
71 | | - global_socket_name2 = joinpath(tempdir(), "jsonrpc-testrun2") |
72 | | - else |
73 | | - error("Unknown operating system.") |
74 | | - end |
| 62 | + global_socket_name2 = JSONRPC.generate_pipe_name() |
75 | 63 |
|
76 | 64 | server_is_up = Base.Condition() |
77 | 65 |
|
|
124 | 112 | @testitem "Static message dispatcher" setup=[TestStructs] begin |
125 | 113 | using Sockets |
126 | 114 | using .TestStructs: Foo, Foo2 |
127 | | - |
128 | | - if Sys.iswindows() |
129 | | - global_socket_name1 = "\\\\.\\pipe\\jsonrpc-testrun3" |
130 | | - elseif Sys.isunix() |
131 | | - global_socket_name1 = joinpath(tempdir(), "jsonrpc-testrun1") |
132 | | - else |
133 | | - error("Unknown operating system.") |
134 | | - end |
| 115 | + |
| 116 | + global_socket_name1 = JSONRPC.generate_pipe_name() |
135 | 117 |
|
136 | 118 | request1_type = JSONRPC.RequestType("request1", Foo, String) |
137 | 119 | request2_type = JSONRPC.RequestType("request2", Nothing, String) |
|
189 | 171 |
|
190 | 172 | # Now we test a faulty server |
191 | 173 |
|
192 | | - if Sys.iswindows() |
193 | | - global_socket_name2 = "\\\\.\\pipe\\jsonrpc-testrun4" |
194 | | - elseif Sys.isunix() |
195 | | - global_socket_name2 = joinpath(tempdir(), "jsonrpc-testrun2") |
196 | | - else |
197 | | - error("Unknown operating system.") |
198 | | - end |
| 174 | + global_socket_name2 = JSONRPC.generate_pipe_name() |
199 | 175 |
|
200 | 176 | server_is_up = Base.Condition() |
201 | 177 |
|
|
0 commit comments