Skip to content

Commit 99148cc

Browse files
committed
Add more tests related to range
1 parent 0a82c74 commit 99148cc

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

ocaml-lsp-server/test/e2e-new/jump_typed_hole.ml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ let rec zip_shortest xs ys =
4141
|ocaml}
4242
;;
4343

44+
let large_amount_of_holes_source =
45+
{ocaml|
46+
let f () =
47+
(_, _, _, (_, _, _, _, _,), _, _, _, _),
48+
_, _, _, _, (_, _, _), _, _, _, _, _, _
49+
|ocaml}
50+
;;
51+
4452
let%expect_test "when there is no hole" =
4553
let source =
4654
{ocaml|
@@ -236,3 +244,35 @@ let%expect_test "prev hole in a given range with cursor outside the range" =
236244
}
237245
|}]
238246
;;
247+
248+
let%expect_test "next on the middle" =
249+
let source = large_amount_of_holes_source
250+
and direction = `Next
251+
and range = range (3, 16) (3, 24)
252+
and line = 3
253+
and character = 20 in
254+
Util.test ~direction ~range ~line ~character source;
255+
[%expect
256+
{|
257+
{
258+
"end": { "character": 24, "line": 3 },
259+
"start": { "character": 23, "line": 3 }
260+
}
261+
|}]
262+
;;
263+
264+
let%expect_test "next at the end" =
265+
let source = large_amount_of_holes_source
266+
and direction = `Next
267+
and range = range (3, 16) (3, 24)
268+
and line = 3
269+
and character = 23 in
270+
Util.test ~direction ~range ~line ~character source;
271+
[%expect
272+
{|
273+
{
274+
"end": { "character": 18, "line": 3 },
275+
"start": { "character": 17, "line": 3 }
276+
}
277+
|}]
278+
;;

0 commit comments

Comments
 (0)