This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,11 @@
(lang dune 1.11)
(dialect
(name d)
(implementation (extension foo))
(interface (extension bar)))
(dialect
(name d)
(implementation (extension foo2))
(interface (extension bar2)))

View file

@ -0,0 +1,9 @@
Duplicate dialect
$ dune build
File "dune-project", lines 9-11, characters 1-74:
9 | (name d)
10 | (implementation (extension foo2))
11 | (interface (extension bar2)))
Error: dialect "d" is already defined
[1]

View file

@ -0,0 +1,11 @@
(lang dune 1.11)
(dialect
(name d)
(implementation (extension foo))
(interface (extension bar)))
(dialect
(name d2)
(implementation (extension foo))
(interface (extension bar2)))

View file

@ -0,0 +1,10 @@
Extension registered twice
$ dune build
File "dune-project", lines 9-11, characters 1-74:
9 | (name d2)
10 | (implementation (extension foo))
11 | (interface (extension bar2)))
Error: extension "foo" is already registered by dialect "d"
[1]

View file

@ -0,0 +1,6 @@
(lang dune 1.11)
(dialect
(name d)
(implementation (extension .foo))
(interface (extension bar)))

View file

@ -0,0 +1,6 @@
$ dune build
File "dune-project", line 5, characters 28-32:
5 | (implementation (extension .foo))
^^^^
Error: extension must not start with '.'
[1]

View file

@ -0,0 +1,2 @@
let () =
print_endline {|print_endline "Hello, World"|}

View file

@ -0,0 +1,11 @@
(executable
(name main)
(modules main))
(executable
(name cppo)
(modules cppo))
(rule
(alias show)
(action (cat main.cppo.ml.ml)))

View file

@ -0,0 +1,8 @@
(dialect
(name cppo)
(implementation
(extension cppo.ml)
(preprocess (run ./cppo.exe %{input-file})))
(interface
(extension cppo.mli)
(preprocess (run ./cppo.exe %{input-file}))))

View file

@ -0,0 +1,23 @@
Test the (dialect ...) stanza inside the `dune-project` file.
$ { echo '(lang dune 3.8)'; cat dune-project.in; } >dune-project
$ dune build --display short
File "dune-project", line 5, characters 13-20:
5 | (extension cppo.ml)
^^^^^^^
Error: the possibility of defining extensions containing periods is only
available since version 3.9 of the dune language. Please update your
dune-project file to have (lang dune 3.9).
[1]
$ { echo '(lang dune 3.9)'; cat dune-project.in; } >dune-project
$ dune build --display short 2>&1 | grep -i cppo
ocamlc .cppo.eobjs/byte/dune__exe__Cppo.{cmi,cmti}
ocamlopt .cppo.eobjs/native/dune__exe__Cppo.{cmx,o}
ocamlopt cppo.exe
cppo main.cppo.ml.ml
$ dune build @show
print_endline "Hello, World"

View file

@ -0,0 +1,7 @@
(env
(_
(binaries ../../utils/ocamlformat.exe)))
(cram
(applies_to :whole_subtree)
(deps %{bin:ocamlformat}))

View file

@ -0,0 +1,9 @@
(executable
(name main)
(public_name main)
(modules main))
(executable
(name fmt)
(public_name fmt)
(modules fmt))

View file

@ -0,0 +1,11 @@
(lang dune 1.11)
(using fmt 1.2 (enabled_for mlfi))
(dialect
(name mlfi)
(implementation
(extension mf)
(format (run fmt %{input-file})))
(interface
(extension mfi)
(format (run fmt %{input-file}))))

View file

@ -0,0 +1 @@
prerr_endline ("Formatting " ^ Sys.argv.(1))

View file

@ -0,0 +1,7 @@
Test the (dialect ...) stanza inside the dune-project file.
$ dune exec ./main.exe
$ dune build @fmt
Formatting main.mf
Formatting main.mfi

View file

@ -0,0 +1,9 @@
(executable
(name main)
(public_name main)
(modules main))
(executable
(name fmt)
(public_name fmt)
(modules fmt))

View file

@ -0,0 +1,7 @@
(lang dune 3.9)
(dialect
(name mlfi)
(interface
(extension mfi)
(format (run fmt %{input-file}))))

View file

@ -0,0 +1 @@
prerr_endline ("Formatting " ^ Sys.argv.(1))

View file

@ -0,0 +1,15 @@
Test the (dialect ...) stanza inside the `dune-project` file.
$ dune exec ./main.exe
$ dune build @fmt
fake ocamlformat is running: "--impl" "fmt.ml"
fake ocamlformat is running: "--impl" "main.ml"
Formatting main.mfi
File "fmt.ml", line 1, characters 0-0:
Error: Files _build/default/fmt.ml and _build/default/.formatted/fmt.ml
differ.
File "main.ml", line 1, characters 0-0:
Error: Files _build/default/main.ml and _build/default/.formatted/main.ml
differ.
[1]

View file

@ -0,0 +1,9 @@
(executable
(name main)
(public_name main)
(modules main))
(executable
(name fmt)
(public_name fmt)
(modules fmt))

View file

@ -0,0 +1,7 @@
(lang dune 3.8)
(dialect
(name mlfi)
(implementation
(extension mf)
(format (run fmt %{input-file}))))

View file

@ -0,0 +1 @@
prerr_endline ("Formatting " ^ Sys.argv.(1))

View file

@ -0,0 +1,25 @@
Test the (dialect ...) stanza inside the `dune-project` file.
$ dune exec ./main.exe
File "dune-project", lines 3-7, characters 0-92:
3 | (dialect
4 | (name mlfi)
5 | (implementation
6 | (extension mf)
7 | (format (run fmt %{input-file}))))
Error: omitting (interface) in dialects is only available since version 3.9
of the dune language. Please update your dune-project file to have (lang dune
3.9).
[1]
$ dune build @fmt
File "dune-project", lines 3-7, characters 0-92:
3 | (dialect
4 | (name mlfi)
5 | (implementation
6 | (extension mf)
7 | (format (run fmt %{input-file}))))
Error: omitting (interface) in dialects is only available since version 3.9
of the dune language. Please update your dune-project file to have (lang dune
3.9).
[1]

View file

@ -0,0 +1,9 @@
(executable
(name main)
(public_name main)
(modules main))
(executable
(name fmt)
(public_name fmt)
(modules fmt))

View file

@ -0,0 +1,7 @@
(lang dune 3.9)
(dialect
(name mlfi)
(implementation
(extension mf)
(format (run fmt %{input-file}))))

View file

@ -0,0 +1 @@
prerr_endline ("Formatting " ^ Sys.argv.(1))

View file

@ -0,0 +1,11 @@
Test the (dialect ...) stanza inside the dune-project file.
$ dune exec ./main.exe
$ dune build @fmt
fake ocamlformat is running: "--impl" "fmt.ml"
Formatting main.mf
File "fmt.ml", line 1, characters 0-0:
Error: Files _build/default/fmt.ml and _build/default/.formatted/fmt.ml
differ.
[1]