My own corner of monopam
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

merlint sweep: fix irmin and memtrace

- irmin: add test/git/test_irmin_git.{ml,mli} + dune so E605 stops
flagging Irmin_git as a library module without a corresponding test
file. Tests cover the git_hash <-> irmin_hash roundtrip.
- memtrace: drop the unused [enabled] entry point. It was the only
exported value with a [string array] type, which tripped E351
(exposed global mutable state). [trace_if_requested] already covers
the use case.

+27 -8
+3
irmin/test/git/dune
··· 1 + (test 2 + (name test) 3 + (libraries irmin_git nox-irmin nox-git alcotest))
+1
irmin/test/git/test.ml
··· 1 + let () = Alcotest.run "Irmin_git" [ Test_irmin_git.suite ]
+21
irmin/test/git/test_irmin_git.ml
··· 1 + let hash_roundtrip () = 2 + let h = Irmin.Hash.sha1 "hello" in 3 + let g = Irmin_git.git_hash h in 4 + let h' = Irmin_git.irmin_hash g in 5 + Alcotest.(check bool) "roundtrip preserves hash" true (Irmin.Hash.equal h h') 6 + 7 + let hash_roundtrip_reverse () = 8 + let g = Git.Hash.digest_string ~kind:`Blob "hello" in 9 + let h = Irmin_git.irmin_hash g in 10 + let g' = Irmin_git.git_hash h in 11 + Alcotest.(check string) 12 + "roundtrip preserves git hash" (Git.Hash.to_hex g) (Git.Hash.to_hex g') 13 + 14 + let suite = 15 + ( "irmin_git", 16 + [ 17 + Alcotest.test_case "hash roundtrip irmin->git->irmin" `Quick 18 + hash_roundtrip; 19 + Alcotest.test_case "hash roundtrip git->irmin->git" `Quick 20 + hash_roundtrip_reverse; 21 + ] )
+2
irmin/test/git/test_irmin_git.mli
··· 1 + val suite : string * unit Alcotest.test_case list 2 + (** Alcotest suite for the {!Irmin_git} module. *)
-3
memtrace/lib/memtrace.ml
··· 122 122 ignore (Cmdliner.Cmd.eval_peek_opts term : unit option * _); 123 123 trace_if_requested_env ?if_started ?context ?sampling_rate () 124 124 125 - let enabled ?argv () = 126 - ignore (Cmdliner.Cmd.eval_peek_opts ?argv term : unit option * _) 127 - 128 125 let start_tracing ~context ~sampling_rate ~filename = 129 126 (* Default of `Fail for backward compatibility *) 130 127 start_tracing ~if_started:`Fail ~context ~sampling_rate ~filename
-5
memtrace/lib/memtrace.mli
··· 51 51 CLI options. When [--memtrace] is provided, tracing starts and stops 52 52 automatically at exit. *) 53 53 54 - val enabled : ?argv:string array -> unit -> unit 55 - (** [enabled ?argv ()] peeks the command-line arguments for [--memtrace] and 56 - starts tracing if present. This is useful for enabling memtrace in programs 57 - that do not use {!term} directly in their cmdliner evaluation. *) 58 - 59 54 module Trace = Trace 60 55 (** Encoder and decoder for trace files. *) 61 56