From 575cbce699893f549b23583982163a989ca30536 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Sun, 29 Apr 2018 00:34:53 +0700 Subject: [PATCH 1/2] Add test showing odoc failure with index.mld --- test/blackbox-tests/gen_tests.ml | 8 +++++--- test/blackbox-tests/jbuild.inc | 12 ++++++++++++ .../test-cases/github717-odoc-index/hello_world.opam | 0 .../test-cases/github717-odoc-index/index.mld | 1 + .../test-cases/github717-odoc-index/jbuild | 8 ++++++++ .../test-cases/github717-odoc-index/run.t | 5 +++++ 6 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 test/blackbox-tests/test-cases/github717-odoc-index/hello_world.opam create mode 100644 test/blackbox-tests/test-cases/github717-odoc-index/index.mld create mode 100644 test/blackbox-tests/test-cases/github717-odoc-index/jbuild create mode 100644 test/blackbox-tests/test-cases/github717-odoc-index/run.t diff --git a/test/blackbox-tests/gen_tests.ml b/test/blackbox-tests/gen_tests.ml index 09067372..c6d8e93f 100644 --- a/test/blackbox-tests/gen_tests.ml +++ b/test/blackbox-tests/gen_tests.ml @@ -89,12 +89,14 @@ end let exclusions = let open Test in + let odoc = make ~external_deps:true ~skip_ocaml:"4.02.3" in [ make "js_of_ocaml" ~external_deps:true ~js:true ~env:("NODE", "${bin:node}") ; make "github25" ~env:("OCAMLPATH", "./findlib-packages") - ; make "odoc" ~external_deps:true ~skip_ocaml:"4.02.3" - ; make "multiple-private-libs" ~external_deps:true ~skip_ocaml:"4.02.3" + ; odoc "odoc" + ; odoc "odoc-unique-mlds" + ; odoc "github717-odoc-index" + ; odoc "multiple-private-libs" ; make "ppx-rewriter" ~skip_ocaml:"4.02.3" ~external_deps:true - ; make "odoc-unique-mlds" ~skip_ocaml:"4.02.3" ~external_deps:true ; make "output-obj" ~skip_platforms:[Mac; Win] ~skip_ocaml:"<4.06.0" ; make "github644" ~external_deps:true ; make "private-public-overlap" ~external_deps:true diff --git a/test/blackbox-tests/jbuild.inc b/test/blackbox-tests/jbuild.inc index 6f8e371b..1eb4e6a5 100644 --- a/test/blackbox-tests/jbuild.inc +++ b/test/blackbox-tests/jbuild.inc @@ -170,6 +170,17 @@ test-cases/github660 (progn (run ${exe:cram.exe} -test run.t) (diff? run.t run.t.corrected)))))) +(alias + ((name github717-odoc-index) + (deps + ((package jbuilder) (files_recursively_in test-cases/github717-odoc-index))) + (action + (chdir + test-cases/github717-odoc-index + (progn + (run ${exe:cram.exe} -skip-versions 4.02.3 -test run.t) + (diff? run.t run.t.corrected)))))) + (alias ((name include-loop) (deps ((package jbuilder) (files_recursively_in test-cases/include-loop))) @@ -454,6 +465,7 @@ (alias github597) (alias github644) (alias github660) + (alias github717-odoc-index) (alias include-loop) (alias inline_tests) (alias installable-dup-private-libs) diff --git a/test/blackbox-tests/test-cases/github717-odoc-index/hello_world.opam b/test/blackbox-tests/test-cases/github717-odoc-index/hello_world.opam new file mode 100644 index 00000000..e69de29b diff --git a/test/blackbox-tests/test-cases/github717-odoc-index/index.mld b/test/blackbox-tests/test-cases/github717-odoc-index/index.mld new file mode 100644 index 00000000..cf74479e --- /dev/null +++ b/test/blackbox-tests/test-cases/github717-odoc-index/index.mld @@ -0,0 +1 @@ +Test index. \ No newline at end of file diff --git a/test/blackbox-tests/test-cases/github717-odoc-index/jbuild b/test/blackbox-tests/test-cases/github717-odoc-index/jbuild new file mode 100644 index 00000000..d881dec3 --- /dev/null +++ b/test/blackbox-tests/test-cases/github717-odoc-index/jbuild @@ -0,0 +1,8 @@ +(jbuild_version 1) + +(library + ((name hello_world) + (public_name hello_world) + (libraries ()))) + +(documentation ()) diff --git a/test/blackbox-tests/test-cases/github717-odoc-index/run.t b/test/blackbox-tests/test-cases/github717-odoc-index/run.t new file mode 100644 index 00000000..409e870e --- /dev/null +++ b/test/blackbox-tests/test-cases/github717-odoc-index/run.t @@ -0,0 +1,5 @@ + $ jbuilder build @doc + Multiple rules generated for _build/default/_doc/_odoc/pkg/hello_world/page-index.odoc: + - + - + [1] From 7b17fa013fd043a2a6807115acd02ff94f9afe6b Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Sun, 29 Apr 2018 00:47:46 +0700 Subject: [PATCH 2/2] Fix #717 Extensions should be removed from the map of basenames to mld paths --- CHANGES.md | 2 ++ src/odoc.ml | 3 ++- test/blackbox-tests/test-cases/github717-odoc-index/run.t | 4 ---- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index c47c6c4a..c7c977cf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -21,6 +21,8 @@ next - `-j` now defaults to the number of processing units available rather 4 (#726, @diml) +- Fix attaching index.mld to documentation (#731, fixes #717 @rgrinberg) + 1.0+beta20 (10/04/2018) ----------------------- diff --git a/src/odoc.ml b/src/odoc.ml index dccc23d9..50d61f4a 100644 --- a/src/odoc.ml +++ b/src/odoc.ml @@ -433,7 +433,8 @@ module Gen (S : sig val sctx : SC.t end) = struct let check_mlds_no_dupes ~pkg ~mlds = match - List.map mlds ~f:(fun mld -> (Path.basename mld, mld)) + List.map mlds ~f:(fun mld -> + (Filename.chop_extension (Path.basename mld), mld)) |> String.Map.of_list with | Ok m -> m diff --git a/test/blackbox-tests/test-cases/github717-odoc-index/run.t b/test/blackbox-tests/test-cases/github717-odoc-index/run.t index 409e870e..bc867e11 100644 --- a/test/blackbox-tests/test-cases/github717-odoc-index/run.t +++ b/test/blackbox-tests/test-cases/github717-odoc-index/run.t @@ -1,5 +1 @@ $ jbuilder build @doc - Multiple rules generated for _build/default/_doc/_odoc/pkg/hello_world/page-index.odoc: - - - - - [1]