Skip to content

Commit e1e25d9

Browse files
committed
More tests.
1 parent 5a6c2e8 commit e1e25d9

File tree

2 files changed

+126
-0
lines changed
  • tests/test-dirs/refactor-extract-region/func-extraction.t

2 files changed

+126
-0
lines changed

tests/test-dirs/refactor-extract-region/func-extraction.t/func.ml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,22 @@ let my_mutable_state =
6767
let var = ref 0 in
6868
var := 10 * 50;
6969
!var
70+
71+
let func () =
72+
let x = [] in
73+
Fun.protect
74+
(fun () ->
75+
let fun_name2 = ( / ) in
76+
let y = [ ( + ); ( - ); fun_name2 ] @ x in
77+
List.map2 (fun op (a, b) -> op a b) y [ (1, 1); (3, 2); (8, 2) ])
78+
~finally:(Fun.const ())
79+
80+
let rec f = List.map Fun.id
81+
82+
and y = [ 10; 20; 30 ]
83+
84+
and z x =
85+
object
86+
method x = x
87+
method y = y
88+
end

tests/test-dirs/refactor-extract-region/func-extraction.t/run.t

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,3 +263,110 @@
263263
},
264264
"notifications": []
265265
}
266+
267+
$ $MERLIN single refactoring-extract-region -start 76:14 -end 76:45 < func.ml
268+
{
269+
"class": "return",
270+
"value": {
271+
"start": {
272+
"line": 71,
273+
"col": 0
274+
},
275+
"end": {
276+
"line": 78,
277+
"col": 27
278+
},
279+
"content": "let fun_name3 (x) (fun_name2) = [(+); (-); fun_name2] @ x
280+
let func () =
281+
let x = [] in
282+
Fun.protect
283+
(fun () ->
284+
let fun_name2 = ( / ) in
285+
let y = fun_name3 x fun_name2 in
286+
List.map2 (fun op (a, b) -> op a b) y [ (1, 1); (3, 2); (8, 2) ])
287+
~finally:(Fun.const ())",
288+
"selection-range": {
289+
"start": {
290+
"line": 71,
291+
"col": 4
292+
},
293+
"end": {
294+
"line": 71,
295+
"col": 13
296+
}
297+
}
298+
},
299+
"notifications": []
300+
}
301+
302+
$ $MERLIN single refactoring-extract-region -start 82:8 -end 82:22 < func.ml
303+
{
304+
"class": "return",
305+
"value": {
306+
"start": {
307+
"line": 80,
308+
"col": 0
309+
},
310+
"end": {
311+
"line": 88,
312+
"col": 5
313+
},
314+
"content": "let fun_name2 () = [10; 20; 30]
315+
let rec f = List.map Fun.id
316+
317+
and y = fun_name2 ()
318+
319+
and z x =
320+
object
321+
method x = x
322+
method y = y
323+
end",
324+
"selection-range": {
325+
"start": {
326+
"line": 80,
327+
"col": 8
328+
},
329+
"end": {
330+
"line": 80,
331+
"col": 17
332+
}
333+
}
334+
},
335+
"notifications": []
336+
}
337+
338+
$ $MERLIN single refactoring-extract-region -start 86:15 -end 86:16 < func.ml
339+
{
340+
"class": "return",
341+
"value": {
342+
"start": {
343+
"line": 80,
344+
"col": 0
345+
},
346+
"end": {
347+
"line": 88,
348+
"col": 5
349+
},
350+
"content": "let rec f = List.map Fun.id
351+
352+
and y = [ 10; 20; 30 ]
353+
354+
and z x =
355+
object
356+
method x = fun_name2 x
357+
method y = y
358+
end
359+
and fun_name2 (x) = x",
360+
"selection-range": {
361+
"start": {
362+
"line": 89,
363+
"col": 4
364+
},
365+
"end": {
366+
"line": 89,
367+
"col": 13
368+
}
369+
}
370+
},
371+
"notifications": []
372+
}

0 commit comments

Comments
 (0)