@@ -125,18 +125,18 @@ test_structured_variables(Config) ->
125125 modules => [
126126 {source , [~ """
127127 -module(foo). %L01\n
128- -export([go/2 ]). %L02\n
129- go(L, X) -> %L03\n
128+ -export([go/3 ]). %L02\n
129+ go(L, X, B ) -> %L03\n
130130 M = [4, [], {6, 7}], %L04\n
131131 F = fun(_A) -> length(L) == length(M) orelse ok end, %L05\n
132132 persistent_term:put(fun_repr, io_lib:format("~p ", [F])),%L06\n
133- {L ++ M, X, F}. %L07\n
133+ {L ++ M, X, B, F}. %L07\n
134134 """ ]}
135135 ]
136136 }),
137137 ok = edb_dap_test_support :configure (Client , [{FooSrc , [{line , 7 }]}]),
138138 {ok , _ThreadId , [#{id := TopFrameId } | _ ]} = edb_dap_test_support :spawn_and_wait_for_bp (
139- Client , Peer , {foo , go , [[1 , 2 , 3 ], #{life => 42 }]}
139+ Client , Peer , {foo , go , [[1 , 2 , 3 ], #{life => 42 }, ~ " abcdefghijklmnopqrstuvwxyz " ]}
140140 ),
141141
142142 Scopes = edb_dap_test_support :get_scopes (Client , TopFrameId ),
@@ -147,13 +147,13 @@ test_structured_variables(Config) ->
147147 name => ~ " Locals" ,
148148 expensive => false ,
149149 presentationHint => ~ " locals" ,
150- variablesReference => 5
150+ variablesReference => 6
151151 },
152152 ~ " Process" =>
153153 #{
154154 name => ~ " Process" ,
155155 expensive => false ,
156- variablesReference => 7
156+ variablesReference => 8
157157 }
158158 },
159159 Scopes
@@ -166,29 +166,35 @@ test_structured_variables(Config) ->
166166
167167 ? assertEqual (
168168 #{
169+ ~ " B" => #{
170+ name => ~ " B" ,
171+ value => ~ " <<\" abcdefghijklmnop\" ...>>" ,
172+ evaluateName => ~ " B" ,
173+ variablesReference => 1
174+ },
169175 ~ " F" => #{
170176 name => ~ " F" ,
171177 value => format (" ~s " , [FunRepr ]),
172178 evaluateName => ~ " F" ,
173- variablesReference => 1
179+ variablesReference => 2
174180 },
175181 ~ " L" => #{
176182 name => ~ " L" ,
177183 value => ~ " [1,2,3]" ,
178184 evaluateName => ~ " L" ,
179- variablesReference => 2
185+ variablesReference => 3
180186 },
181187 ~ " M" => #{
182188 name => ~ " M" ,
183189 value => ~ " [4,[],{6,...}]" ,
184190 evaluateName => ~ " M" ,
185- variablesReference => 3
191+ variablesReference => 4
186192 },
187193 ~ " X" => #{
188194 name => ~ " X" ,
189195 value => ~ " #{life => 42}" ,
190196 evaluateName => ~ " X" ,
191- variablesReference => 4
197+ variablesReference => 5
192198 }
193199 },
194200 LocalVars
@@ -204,7 +210,7 @@ test_structured_variables(Config) ->
204210 name => ~ " 3" ,
205211 value => ~ " {6,7}" ,
206212 evaluateName => ~ " lists:nth(3, M)" ,
207- variablesReference => 8
213+ variablesReference => 9
208214 }
209215 },
210216 ChildrenListVars
@@ -219,19 +225,33 @@ test_structured_variables(Config) ->
219225 ChildrenMapVars
220226 ),
221227
228+ ChildBinaryVarRef = maps :get (variablesReference , maps :get (~ " B" , LocalVars )),
229+ ChildrenBinaryVars = edb_dap_test_support :get_variables (Client , ChildBinaryVarRef ),
230+ ? assertEqual (
231+ #{
232+ integer_to_binary (I ) => #{
233+ name => integer_to_binary (I ),
234+ value => integer_to_binary ($a + I ),
235+ variablesReference => 0
236+ }
237+ || I <- lists :seq (0 , 25 )
238+ },
239+ ChildrenBinaryVars
240+ ),
241+
222242 ChildFunVarRef = maps :get (variablesReference , maps :get (~ " F" , LocalVars )),
223243 ChildrenFunVars = edb_dap_test_support :get_variables (Client , ChildFunVarRef ),
224244 ? assertEqual (
225245 #{
226246 ~ " fun" => #{
227247 name => ~ " fun" ,
228- value => ~ " foo:'-go/2 -fun-0-'/1" ,
248+ value => ~ " foo:'-go/3 -fun-0-'/1" ,
229249 variablesReference => 0
230250 },
231251 ~ " env" => #{
232252 name => ~ " env" ,
233253 value => ~ " [[1,2,3],[4,[]|...]]" ,
234- variablesReference => 9 ,
254+ variablesReference => 10 ,
235255 evaluateName => ~ " erlang:element(2, erlang:fun_info(F, env))"
236256 }
237257 },
@@ -263,9 +283,9 @@ test_structured_variables_with_pagination(Config) ->
263283 modules => [
264284 {source , [~ """
265285 -module(foo). %L01\n
266- -export([go/3 ]). %L02\n
267- go(L, T, M) -> %L03\n
268- {L, T, M}. %L04\n
286+ -export([go/4 ]). %L02\n
287+ go(L, T, M, B ) -> %L03\n
288+ {L, T, M, B}. %L04\n
269289 """ ]}
270290 ]
271291 }),
@@ -274,8 +294,9 @@ test_structured_variables_with_pagination(Config) ->
274294 L = [10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 , 90 ],
275295 T = {4 , [], {6 , 7 }, 8 , {}, 9 },
276296 M = #{life => 42 , death => 43 , etc => 44 , more => {45 , 46 , 47 }, universe => 99 },
297+ B = ~ " abcdefghijklmnopqrstuvwxyz" ,
277298 {ok , _ThreadId , [#{id := TopFrameId } | _ ]} = edb_dap_test_support :spawn_and_wait_for_bp (
278- Client , Peer , {foo , go , [L , T , M ]}
299+ Client , Peer , {foo , go , [L , T , M , B ]}
279300 ),
280301
281302 % When client supports variable paging, scopes include variable count
@@ -285,8 +306,8 @@ test_structured_variables_with_pagination(Config) ->
285306 name => ~ " Locals" ,
286307 expensive => false ,
287308 presentationHint => ~ " locals" ,
288- variablesReference => 4 ,
289- indexedVariables => 3
309+ variablesReference => 5 ,
310+ indexedVariables => 4
290311 },
291312 LocalsScope
292313 ),
@@ -300,22 +321,29 @@ test_structured_variables_with_pagination(Config) ->
300321 name => ~ " L" ,
301322 evaluateName => ~ " L" ,
302323 value => ~ " [10,20,30,40|...]" ,
303- variablesReference => 1 ,
324+ variablesReference => 2 ,
304325 indexedVariables => 9
305326 },
306327 ~ " T" => #{
307328 name => ~ " T" ,
308329 evaluateName => ~ " T" ,
309330 value => ~ " {4,[],{6,...},8,...}" ,
310- variablesReference => 3 ,
331+ variablesReference => 4 ,
311332 indexedVariables => 6
312333 },
313334 ~ " M" => #{
314335 name => ~ " M" ,
315336 evaluateName => ~ " M" ,
316337 value => ~ " #{death => 43,etc => 44,life => 42,more => {45,46,47},...}" ,
317- variablesReference => 2 ,
338+ variablesReference => 3 ,
318339 indexedVariables => 5
340+ },
341+ ~ " B" => #{
342+ name => ~ " B" ,
343+ evaluateName => ~ " B" ,
344+ value => ~ " <<\" abcdefghijklmnop\" ...>>" ,
345+ variablesReference => 1 ,
346+ indexedVariables => 26
319347 }
320348 },
321349 LocalVars
@@ -341,7 +369,7 @@ test_structured_variables_with_pagination(Config) ->
341369 name => ~ " 3" ,
342370 value => ~ " {6,7}" ,
343371 evaluateName => ~ " erlang:element(3, T)" ,
344- variablesReference => 7 ,
372+ variablesReference => 8 ,
345373 indexedVariables => 2
346374 },
347375 #{name => ~ " 4" , value => ~ " 8" , variablesReference => 0 },
@@ -359,13 +387,24 @@ test_structured_variables_with_pagination(Config) ->
359387 #{
360388 name => ~ " more" ,
361389 value => ~ " {45,46,47}" ,
362- variablesReference => 8 ,
390+ variablesReference => 9 ,
363391 evaluateName => ~ " maps:get(more, M)" ,
364392 indexedVariables => 3
365393 }
366394 ],
367395 get_variables_page (Client , MapVarsRef , #{start => 1 , count => 3 })
368396 ),
397+
398+ % Test pagination for binaries
399+ BinVarsRef = maps :get (variablesReference , maps :get (~ " B" , LocalVars )),
400+ ? assertEqual (
401+ [
402+ #{name => <<" 1" >>, value => <<" 98" >>, variablesReference => 0 },
403+ #{name => <<" 2" >>, value => <<" 99" >>, variablesReference => 0 },
404+ #{name => <<" 3" >>, value => <<" 100" >>, variablesReference => 0 }
405+ ],
406+ get_variables_page (Client , BinVarsRef , #{start => 1 , count => 3 })
407+ ),
369408 ok .
370409
371410test_reports_registers_scope_when_locals_not_available (Config ) ->
0 commit comments