mirror of
https://git.sr.ht/~bryan_bennett/flake_env
synced 2025-12-16 14:41:24 +01:00
Move version pprint into Version module
This commit is contained in:
parent
33aa9228e2
commit
081ed58524
2 changed files with 5 additions and 12 deletions
|
|
@ -9,8 +9,12 @@ type t = {
|
|||
point: int,
|
||||
};
|
||||
|
||||
/*** Initialize a Versions.t from major, minor, and point versions */
|
||||
let init = (major, minor, point) => {major, minor, point};
|
||||
|
||||
let pprint = (pp_fmt, t) =>
|
||||
Format.fprintf(pp_fmt, "{ %d.%d.%d }", t.major, t.minor, t.point);
|
||||
|
||||
let required_direnv_version = init(2, 21, 3);
|
||||
|
||||
let required_nix_version = init(2, 10, 0);
|
||||
|
|
|
|||
|
|
@ -1,18 +1,7 @@
|
|||
open Lib;
|
||||
|
||||
let pprint = (pp_fmt, version) => {
|
||||
Versions.(
|
||||
Fmt.pf(
|
||||
pp_fmt,
|
||||
"{ major: %d, minor: %d, point: %d }",
|
||||
version.major,
|
||||
version.minor,
|
||||
version.point,
|
||||
)
|
||||
);
|
||||
};
|
||||
let testable_version =
|
||||
Alcotest.testable(pprint, (a, b) => Versions.compare(a, b) == 0);
|
||||
Alcotest.testable(Versions.pprint, (a, b) => Versions.compare(a, b) == 0);
|
||||
|
||||
let check_version =
|
||||
Alcotest.(check(Alcotest.result(testable_version, string)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue