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,14 @@
(executables (names hello hexdump))
(rule (with-stdout-to hello.output (run ./hello.exe)))
(alias
(name runtest)
(action (diff hello.expected hello.output)))
(rule (with-stdout-to a (echo "toto\n")))
(rule (with-stdout-to b (echo "toto\r\n")))
(alias
(name cmp)
(action (cmp a b)))

View file

@ -0,0 +1 @@
(lang dune 1.0)

View file

@ -0,0 +1 @@
let () = print_endline "Hello, world!"

View file

@ -0,0 +1,19 @@
let () =
let ic = open_in_bin Sys.argv.(1) in
let col = ref 0 in
try
while true do
let x = Char.code (input_char ic) in
(match !col with
| 0 -> ()
| 8 -> print_string " "
| _ -> print_char ' ');
incr col;
Printf.printf "%02x" x;
if !col = 16 then begin
print_newline ();
col := 0;
end
done
with End_of_file ->
if !col <> 0 then print_newline ()

View file

@ -0,0 +1,22 @@
$ echo 'Hello, world!' > hello.expected
$ dune runtest
$ cp hello.wrong-output hello.expected
$ dune runtest
File "hello.expected", line 1, characters 0-0:
Error: Files _build/default/hello.expected and _build/default/hello.output
differ.
[1]
$ dune promote
Promoting _build/default/hello.output to hello.expected.
$ cat hello.expected
Hello, world!
$ dune build @cmp
File "dune", lines 12-14, characters 0-41:
12 | (alias
13 | (name cmp)
14 | (action (cmp a b)))
Error: Files _build/default/a and _build/default/b differ.
[1]