Something went wrong. Try again.
A local Git merge queue with content-bound gate verdicts
Something went wrong. Try again.
1.5 kB · 45 lines
OCaml
at main
12345678910111213141516171819202122232425262728293031323334353637383940414243444546open Merge_queue
let hex = "e83c5163316f89bfbde7d9ab23ca2e25604af290"let commit = Option.get (Commit.of_hex hex)
let test_hex () = Alcotest.(check string) "to_hex" hex (Commit.to_hex commit); Alcotest.(check string) "pp" hex (Fmt.str "%a" Commit.pp commit); Alcotest.(check string) "the hash" hex (Git.Hash.to_hex (commit :> Git.Hash.t)); Alcotest.(check bool) "of_hash" true (Commit.equal commit (Commit.of_hash (Git.Hash.of_hex hex)))
let test_refused () = let none s = Alcotest.(check bool) s true (Option.is_none (Commit.of_hex s)) in none ""; none "e83c5163316f"; none "x83c5163316f89bfbde7d9ab23ca2e25604af290"; none (hex ^ "0")
(* doc/outcomes.md prints a commit by the first twelve digits of its id. *)let test_short () = Alcotest.(check string) "short" "e83c5163316f" (Commit.short commit)
let test_order () = let other = Option.get (Commit.of_hex "0000000000000000000000000000000000000001") in Alcotest.(check bool) "equal" true (Commit.equal commit commit); Alcotest.(check bool) "not equal" false (Commit.equal commit other); Alcotest.(check bool) "compare" true (Commit.compare other commit < 0); Alcotest.(check int) "compare self" 0 (Commit.compare commit commit)
let suite = ( "commit", [ Alcotest.test_case "hexadecimal" `Quick test_hex; Alcotest.test_case "not an id" `Quick test_refused; Alcotest.test_case "short" `Quick test_short; Alcotest.test_case "order" `Quick test_order; ] )