From 658fcfa412ef17253f680eff4edc6f8ec2b91ef8 Mon Sep 17 00:00:00 2001 From: brendanzab Date: Wed, 13 Nov 2024 16:08:51 +1100 Subject: [PATCH] test: Sibling modules should be accessible from qualified parsers Signed-off-by: brendanzab --- .../test-cases/menhir/include-subdirs-siblings.t/dune | 4 ++++ .../menhir/include-subdirs-siblings.t/dune-project | 2 ++ .../test-cases/menhir/include-subdirs-siblings.t/foo.ml | 2 ++ .../menhir/include-subdirs-siblings.t/lang/ast.ml | 2 ++ .../menhir/include-subdirs-siblings.t/lang/dune | 2 ++ .../menhir/include-subdirs-siblings.t/lang/parser.mly | 8 ++++++++ .../test-cases/menhir/include-subdirs-siblings.t/run.t | 6 ++++++ 7 files changed, 26 insertions(+) create mode 100644 test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/dune create mode 100644 test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/dune-project create mode 100644 test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/foo.ml create mode 100644 test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/lang/ast.ml create mode 100644 test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/lang/dune create mode 100644 test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/lang/parser.mly create mode 100644 test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/run.t diff --git a/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/dune b/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/dune new file mode 100644 index 00000000000..45f29f8e795 --- /dev/null +++ b/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/dune @@ -0,0 +1,4 @@ +(include_subdirs qualified) + +(executable + (name foo)) diff --git a/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/dune-project b/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/dune-project new file mode 100644 index 00000000000..83aec0c1e98 --- /dev/null +++ b/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/dune-project @@ -0,0 +1,2 @@ +(lang dune 3.14) +(using menhir 2.1) diff --git a/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/foo.ml b/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/foo.ml new file mode 100644 index 00000000000..bc74ee409f1 --- /dev/null +++ b/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/foo.ml @@ -0,0 +1,2 @@ +let () = + assert (Lang.Parser.expr (fun _ -> Lang.Parser.EOF) (Lexing.from_string "") = Lang.Ast.Unit) diff --git a/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/lang/ast.ml b/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/lang/ast.ml new file mode 100644 index 00000000000..693afa7c6c1 --- /dev/null +++ b/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/lang/ast.ml @@ -0,0 +1,2 @@ +type expr = + | Unit diff --git a/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/lang/dune b/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/lang/dune new file mode 100644 index 00000000000..f86a14e453c --- /dev/null +++ b/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/lang/dune @@ -0,0 +1,2 @@ +(menhir + (modules parser)) diff --git a/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/lang/parser.mly b/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/lang/parser.mly new file mode 100644 index 00000000000..4ef24b5a11f --- /dev/null +++ b/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/lang/parser.mly @@ -0,0 +1,8 @@ +%token EOF + +%start expr + +%% + +expr: +| EOF { Ast.Unit } diff --git a/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/run.t b/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/run.t new file mode 100644 index 00000000000..78b2d35fd4d --- /dev/null +++ b/test/blackbox-tests/test-cases/menhir/include-subdirs-siblings.t/run.t @@ -0,0 +1,6 @@ +Menhir parsers in qualified subdirectories should be able to refer to sibling modules: + + $ dune build + File "lang/parser.mly", line 3, characters 8-16: + Error: Unbound module Ast + [1]