From 38d930e3450cd66db975d35d1fe983f83ef8496c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulysse=20G=C3=A9rard?= Date: Thu, 22 Feb 2024 17:06:36 +0100 Subject: [PATCH] test: add a test for project-wide occurrences Requires ocaml-index --- .../occurrences/project-wide/pwo-basic.t | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 tests/test-dirs/occurrences/project-wide/pwo-basic.t diff --git a/tests/test-dirs/occurrences/project-wide/pwo-basic.t b/tests/test-dirs/occurrences/project-wide/pwo-basic.t new file mode 100644 index 000000000..dcc5b295f --- /dev/null +++ b/tests/test-dirs/occurrences/project-wide/pwo-basic.t @@ -0,0 +1,65 @@ + $ cat >lib.ml <<'EOF' + > let foo = "bar" + > let () = print_string foo + > EOF + + $ cat >main.ml <<'EOF' + > let () = print_string Lib.foo + > EOF + + $ ocamlc -bin-annot -bin-annot-occurrences -c lib.ml main.ml + + $ ocaml-index aggregate main.cmt lib.cmt + $ ocaml-index dump project.ocaml-index + 2 uids: + {uid: Stdlib.312; locs: + "print_string": File "lib.ml", line 2, characters 9-21; + "print_string": File "main.ml", line 1, characters 9-21 + uid: Lib.0; locs: + "foo": File "lib.ml", line 1, characters 4-7; + "foo": File "lib.ml", line 2, characters 22-25; + "Lib.foo": File "main.ml", line 1, characters 22-29 + }, 0 approx shapes: {}, and shapes for CUS . + + $ $MERLIN single occurrences -scope project -identifier-at 1:28 \ + > -index-file project.ocaml-index \ + > -filename main.ml