From 9c701c32b4b8f631a51c4b419b37cb97fe714b11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulysse=20G=C3=A9rard?= Date: Mon, 23 Dec 2024 13:51:28 +0100 Subject: [PATCH] test: renaming a functor value included from its parameter --- .../for-renaming/r-with-functors.t/dune | 2 ++ .../r-with-functors.t/dune-project | 1 + .../for-renaming/r-with-functors.t/func.ml | 5 +++ .../for-renaming/r-with-functors.t/func.mli | 5 +++ .../for-renaming/r-with-functors.t/main.ml | 4 +++ .../for-renaming/r-with-functors.t/run.t | 34 +++++++++++++++++++ 6 files changed, 51 insertions(+) create mode 100644 tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/dune create mode 100644 tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/dune-project create mode 100644 tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/func.ml create mode 100644 tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/func.mli create mode 100644 tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/main.ml create mode 100644 tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/run.t diff --git a/tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/dune b/tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/dune new file mode 100644 index 0000000000..69dd4adeac --- /dev/null +++ b/tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/dune @@ -0,0 +1,2 @@ +(executable + (name main)) diff --git a/tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/dune-project b/tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/dune-project new file mode 100644 index 0000000000..3e2a6150dd --- /dev/null +++ b/tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/dune-project @@ -0,0 +1 @@ +(lang dune 3.17) diff --git a/tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/func.ml b/tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/func.ml new file mode 100644 index 0000000000..216fb381b9 --- /dev/null +++ b/tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/func.ml @@ -0,0 +1,5 @@ +module type P = sig val txt : string end + +module Make (Params : sig val txt : string end) = struct + include Params +end diff --git a/tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/func.mli b/tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/func.mli new file mode 100644 index 0000000000..a8b2a2671d --- /dev/null +++ b/tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/func.mli @@ -0,0 +1,5 @@ +module type P = sig val txt : string end + +module Make (_ : P) : sig + include P +end diff --git a/tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/main.ml b/tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/main.ml new file mode 100644 index 0000000000..c9bd6e8fa2 --- /dev/null +++ b/tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/main.ml @@ -0,0 +1,4 @@ +module P = struct let txt = "Hello world!" end;; +module M = Func.Make(P);; + +print_endline M.txt diff --git a/tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/run.t b/tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/run.t new file mode 100644 index 0000000000..d28346bf3b --- /dev/null +++ b/tests/test-dirs/occurrences/project-wide/for-renaming/r-with-functors.t/run.t @@ -0,0 +1,34 @@ + + $ $DUNE build @ocaml-index + + $ $DUNE exec ./main.exe + Hello world! + +We expect 2 occurrences in func.ml, 1 in func.mli and 2 in main.ml + $ $MERLIN single occurrences -scope renaming -identifier-at 4:18 \ + > -filename main.ml