From a18ce7f46c921cf191351eff81a47ec34c353fed Mon Sep 17 00:00:00 2001 From: Marek Kubica Date: Wed, 29 Apr 2026 15:08:33 +0200 Subject: [PATCH] Add OxCaml implementation file test This adds a file that contains just an implementation, without an interface, to show how OxCaml code is rendered. --- test/generators/cases/oxcaml_impl.ml | 1 + test/generators/gen_rules/gen_rules.ml | 1 + test/generators/html/Oxcaml_impl.html | 32 ++++ test/generators/html/Oxcaml_impl.md | 0 test/generators/html/oxcaml_impl.targets | 1 + test/generators/latex/Oxcaml_impl.md | 0 test/generators/latex/Oxcaml_impl.tex | 4 + test/generators/latex/oxcaml_impl.targets | 1 + test/generators/link.dune.inc | 179 +++++++++++++++++++ test/generators/man/Oxcaml_impl.3o | 14 ++ test/generators/man/oxcaml_impl.targets | 1 + test/generators/markdown/Oxcaml_impl.md | 6 + test/generators/markdown/oxcaml_impl.targets | 1 + 13 files changed, 241 insertions(+) create mode 100644 test/generators/cases/oxcaml_impl.ml create mode 100644 test/generators/html/Oxcaml_impl.html create mode 100644 test/generators/html/Oxcaml_impl.md create mode 100644 test/generators/html/oxcaml_impl.targets create mode 100644 test/generators/latex/Oxcaml_impl.md create mode 100644 test/generators/latex/Oxcaml_impl.tex create mode 100644 test/generators/latex/oxcaml_impl.targets create mode 100644 test/generators/man/Oxcaml_impl.3o create mode 100644 test/generators/man/oxcaml_impl.targets create mode 100644 test/generators/markdown/Oxcaml_impl.md create mode 100644 test/generators/markdown/oxcaml_impl.targets diff --git a/test/generators/cases/oxcaml_impl.ml b/test/generators/cases/oxcaml_impl.ml new file mode 100644 index 0000000000..0acf368d58 --- /dev/null +++ b/test/generators/cases/oxcaml_impl.ml @@ -0,0 +1 @@ +let[@zero_alloc] add b x y = if b then x + y else x diff --git a/test/generators/gen_rules/gen_rules.ml b/test/generators/gen_rules/gen_rules.ml index 1548f8a26d..b02b0d7de4 100644 --- a/test/generators/gen_rules/gen_rules.ml +++ b/test/generators/gen_rules/gen_rules.ml @@ -69,6 +69,7 @@ let constraints = ("functor_ml.ml", Min "4.14"); ("ocaml_55.mli", Min "5.5"); ("oxcaml.mli", OxCaml); + ("oxcaml_impl.ml", OxCaml); ] let test_cases_dir = Fpath.v "cases" diff --git a/test/generators/html/Oxcaml_impl.html b/test/generators/html/Oxcaml_impl.html new file mode 100644 index 0000000000..abca99a904 --- /dev/null +++ b/test/generators/html/Oxcaml_impl.html @@ -0,0 +1,32 @@ + + + Oxcaml_impl (Oxcaml_impl) + + + + + + + + +
+

Module Oxcaml_impl

+
+
+
+
+ + + val add : + bool -> + int -> + int -> int + + +
+
+
+ + diff --git a/test/generators/html/Oxcaml_impl.md b/test/generators/html/Oxcaml_impl.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/generators/html/oxcaml_impl.targets b/test/generators/html/oxcaml_impl.targets new file mode 100644 index 0000000000..ca9a0a5c81 --- /dev/null +++ b/test/generators/html/oxcaml_impl.targets @@ -0,0 +1 @@ +Oxcaml_impl.html diff --git a/test/generators/latex/Oxcaml_impl.md b/test/generators/latex/Oxcaml_impl.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/generators/latex/Oxcaml_impl.tex b/test/generators/latex/Oxcaml_impl.tex new file mode 100644 index 0000000000..877b91ddab --- /dev/null +++ b/test/generators/latex/Oxcaml_impl.tex @@ -0,0 +1,4 @@ +\section{Module \ocamlinlinecode{Oxcaml\_\allowbreak{}impl}}\label{Oxcaml_impl}% +\label{Oxcaml_impl--val-add}\ocamlcodefragment{\ocamltag{keyword}{val} add : bool \ocamltag{arrow}{$\rightarrow$} int \ocamltag{arrow}{$\rightarrow$} int \ocamltag{arrow}{$\rightarrow$} int}\\ + + diff --git a/test/generators/latex/oxcaml_impl.targets b/test/generators/latex/oxcaml_impl.targets new file mode 100644 index 0000000000..cb01981b28 --- /dev/null +++ b/test/generators/latex/oxcaml_impl.targets @@ -0,0 +1 @@ +Oxcaml_impl.tex diff --git a/test/generators/link.dune.inc b/test/generators/link.dune.inc index 88177118d6..ffebf7367d 100644 --- a/test/generators/link.dune.inc +++ b/test/generators/link.dune.inc @@ -611,6 +611,27 @@ (run odoc link -o %{target} %{dep:oxcaml.odoc})) (enabled_if %{ocaml-config:ox})) +(rule + (target oxcaml_impl.cmt) + (package odoc) + (action + (run ocamlc -c -bin-annot -o %{target} %{dep:cases/oxcaml_impl.ml})) + (enabled_if %{ocaml-config:ox})) + +(rule + (target oxcaml_impl.odoc) + (package odoc) + (action + (run odoc compile -o %{target} %{dep:oxcaml_impl.cmt})) + (enabled_if %{ocaml-config:ox})) + +(rule + (target oxcaml_impl.odocl) + (package odoc) + (action + (run odoc link -o %{target} %{dep:oxcaml_impl.odoc})) + (enabled_if %{ocaml-config:ox})) + (rule (target recent.cmti) (package odoc) @@ -12060,6 +12081,164 @@ (diff oxcaml.targets oxcaml.targets.gen)) (enabled_if %{ocaml-config:ox}))) +(subdir + html + (rule + (targets Oxcaml_impl.html.gen) + (package odoc) + (action + (run + odoc + html-generate + --indent + --flat + --extra-suffix + gen + -o + . + %{dep:../oxcaml_impl.odocl})) + (enabled_if %{ocaml-config:ox})) + (rule + (alias runtest) + (package odoc) + (action + (diff Oxcaml_impl.html Oxcaml_impl.html.gen)) + (enabled_if %{ocaml-config:ox}))) + +(subdir + html + (rule + (target oxcaml_impl.targets.gen) + (package odoc) + (action + (with-outputs-to + oxcaml_impl.targets.gen + (run odoc html-targets -o . %{dep:../oxcaml_impl.odocl} --flat))) + (enabled_if %{ocaml-config:ox})) + (rule + (alias runtest) + (package odoc) + (action + (diff oxcaml_impl.targets oxcaml_impl.targets.gen)) + (enabled_if %{ocaml-config:ox}))) + +(subdir + latex + (rule + (targets Oxcaml_impl.tex.gen) + (package odoc) + (action + (run + odoc + latex-generate + -o + . + --extra-suffix + gen + %{dep:../oxcaml_impl.odocl})) + (enabled_if %{ocaml-config:ox})) + (rule + (alias runtest) + (package odoc) + (action + (diff Oxcaml_impl.tex Oxcaml_impl.tex.gen)) + (enabled_if %{ocaml-config:ox}))) + +(subdir + latex + (rule + (target oxcaml_impl.targets.gen) + (package odoc) + (action + (with-outputs-to + oxcaml_impl.targets.gen + (run odoc latex-targets -o . %{dep:../oxcaml_impl.odocl}))) + (enabled_if %{ocaml-config:ox})) + (rule + (alias runtest) + (package odoc) + (action + (diff oxcaml_impl.targets oxcaml_impl.targets.gen)) + (enabled_if %{ocaml-config:ox}))) + +(subdir + man + (rule + (targets Oxcaml_impl.3o.gen) + (package odoc) + (action + (run + odoc + man-generate + -o + . + --extra-suffix + gen + %{dep:../oxcaml_impl.odocl})) + (enabled_if %{ocaml-config:ox})) + (rule + (alias runtest) + (package odoc) + (action + (diff Oxcaml_impl.3o Oxcaml_impl.3o.gen)) + (enabled_if %{ocaml-config:ox}))) + +(subdir + man + (rule + (target oxcaml_impl.targets.gen) + (package odoc) + (action + (with-outputs-to + oxcaml_impl.targets.gen + (run odoc man-targets -o . %{dep:../oxcaml_impl.odocl}))) + (enabled_if %{ocaml-config:ox})) + (rule + (alias runtest) + (package odoc) + (action + (diff oxcaml_impl.targets oxcaml_impl.targets.gen)) + (enabled_if %{ocaml-config:ox}))) + +(subdir + markdown + (rule + (targets Oxcaml_impl.md.gen) + (package odoc) + (action + (run + odoc + markdown-generate + -o + . + --extra-suffix + gen + %{dep:../oxcaml_impl.odocl})) + (enabled_if %{ocaml-config:ox})) + (rule + (alias runtest) + (package odoc) + (action + (diff Oxcaml_impl.md Oxcaml_impl.md.gen)) + (enabled_if %{ocaml-config:ox}))) + +(subdir + markdown + (rule + (target oxcaml_impl.targets.gen) + (package odoc) + (action + (with-outputs-to + oxcaml_impl.targets.gen + (run odoc markdown-targets -o . %{dep:../oxcaml_impl.odocl}))) + (enabled_if %{ocaml-config:ox})) + (rule + (alias runtest) + (package odoc) + (action + (diff oxcaml_impl.targets oxcaml_impl.targets.gen)) + (enabled_if %{ocaml-config:ox}))) + (subdir html (rule diff --git a/test/generators/man/Oxcaml_impl.3o b/test/generators/man/Oxcaml_impl.3o new file mode 100644 index 0000000000..b9f95fd912 --- /dev/null +++ b/test/generators/man/Oxcaml_impl.3o @@ -0,0 +1,14 @@ + +.TH Oxcaml_impl 3 "" "Odoc" "OCaml Library" +.SH Name +Oxcaml_impl +.SH Synopsis +.sp +.in 2 +\fBModule Oxcaml_impl\fR +.in +.sp +.SH Documentation +.sp +.nf +\f[CB]val\fR add : bool \f[CB]\->\fR int \f[CB]\->\fR int \f[CB]\->\fR int diff --git a/test/generators/man/oxcaml_impl.targets b/test/generators/man/oxcaml_impl.targets new file mode 100644 index 0000000000..49c2ce35e0 --- /dev/null +++ b/test/generators/man/oxcaml_impl.targets @@ -0,0 +1 @@ +Oxcaml_impl.3o diff --git a/test/generators/markdown/Oxcaml_impl.md b/test/generators/markdown/Oxcaml_impl.md new file mode 100644 index 0000000000..c5dec65734 --- /dev/null +++ b/test/generators/markdown/Oxcaml_impl.md @@ -0,0 +1,6 @@ + +# Module `Oxcaml_impl` + +```ocaml +val add : bool -> int -> int -> int +``` \ No newline at end of file diff --git a/test/generators/markdown/oxcaml_impl.targets b/test/generators/markdown/oxcaml_impl.targets new file mode 100644 index 0000000000..518188a1fb --- /dev/null +++ b/test/generators/markdown/oxcaml_impl.targets @@ -0,0 +1 @@ +Oxcaml_impl.md