OCaml library and CLI for OCI and Docker image manipulation
0
fork

Configure Feed

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

fix(oci): add missing test .mli files and test_common (E600, E605)

Add .mli interfaces for 13 test modules that were missing them.
Add test_common.ml with tests for JSON helpers, error functions,
and base64 roundtrip.

+84
+2
test/spec/test_attestation.mli
··· 1 + val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+2
test/spec/test_cache.mli
··· 1 + val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+2
test/spec/test_checkout.mli
··· 1 + val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+56
test/spec/test_common.ml
··· 1 + open Oci_spec 2 + 3 + let test_json_roundtrip () = 4 + let json_str = {|{"foo":"bar","n":42}|} in 5 + match Common.json_of_string json_str with 6 + | Error e -> Alcotest.failf "json_of_string: %s" e 7 + | Ok json -> 8 + let s = Common.json_to_string json in 9 + Alcotest.(check bool) "non-empty" true (String.length s > 0) 10 + 11 + let test_json_of_invalid () = 12 + match Common.json_of_string "not json" with 13 + | Ok _ -> Alcotest.fail "expected error" 14 + | Error _ -> () 15 + 16 + let test_json_to_string_null () = 17 + let json = Jsont.Null ((), Jsont.Meta.none) in 18 + let s = Common.json_to_string json in 19 + Alcotest.(check string) "null" "null" s 20 + 21 + let test_error_msg () = 22 + let r : (int, [ `Msg of string ]) result = Common.error_msg "bad %d" 42 in 23 + match r with 24 + | Error (`Msg s) -> Alcotest.(check string) "msg" "bad 42" s 25 + | Ok _ -> Alcotest.fail "expected error" 26 + 27 + let test_unwrap () = 28 + let r = Common.unwrap (Error (`Msg "e")) in 29 + match r with 30 + | Error s -> Alcotest.(check string) "unwrap" "e" s 31 + | Ok _ -> Alcotest.fail "expected error" 32 + 33 + let test_wrap () = 34 + let r = Common.wrap (Error "e") in 35 + match r with 36 + | Error (`Msg s) -> Alcotest.(check string) "wrap" "e" s 37 + | Ok _ -> Alcotest.fail "expected error" 38 + 39 + let test_base64_roundtrip () = 40 + let original = "hello world" in 41 + let encoded = Common.Base64.encode original in 42 + match Common.Base64.decode encoded with 43 + | Ok decoded -> Alcotest.(check string) "roundtrip" original decoded 44 + | Error (`Msg e) -> Alcotest.failf "decode: %s" e 45 + 46 + let suite = 47 + ( "common", 48 + [ 49 + Alcotest.test_case "json roundtrip" `Quick test_json_roundtrip; 50 + Alcotest.test_case "json invalid" `Quick test_json_of_invalid; 51 + Alcotest.test_case "json to_string null" `Quick test_json_to_string_null; 52 + Alcotest.test_case "error_msg" `Quick test_error_msg; 53 + Alcotest.test_case "unwrap" `Quick test_unwrap; 54 + Alcotest.test_case "wrap" `Quick test_wrap; 55 + Alcotest.test_case "base64 roundtrip" `Quick test_base64_roundtrip; 56 + ] )
+2
test/spec/test_common.mli
··· 1 + val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+2
test/spec/test_display.mli
··· 1 + val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+2
test/spec/test_fetch.mli
··· 1 + val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+2
test/spec/test_flow.mli
··· 1 + val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+2
test/spec/test_image.mli
··· 1 + val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+2
test/spec/test_ls.mli
··· 1 + val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+2
test/spec/test_oci.mli
··· 1 + val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+2
test/spec/test_oci_spec.mli
··· 1 + val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+2
test/spec/test_push.mli
··· 1 + val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+2
test/spec/test_show.mli
··· 1 + val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)
+2
test/spec/test_util.mli
··· 1 + val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)