Persistent store with Git semantics: lazy reads, delayed writes, content-addressing
1
fork

Configure Feed

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

irmin/test: reflow after dune fmt

+143 -121
+8 -8
test/cbor/test_irmin_cbor.ml
··· 1 1 (** Tests for [Irmin_cbor]. 2 2 3 3 Spec: 4 - - CBOR maps whose keys are text strings become [Named] children. Values 5 - are re-encoded as CBOR bytes and stored [`Inline]. 4 + - CBOR maps whose keys are text strings become [Named] children. Values are 5 + re-encoded as CBOR bytes and stored [`Inline]. 6 6 - CBOR arrays become [Indexed] children. Elements are re-encoded as CBOR 7 7 bytes. 8 8 - Non-text-keyed map entries are dropped silently. ··· 40 40 match c with 41 41 | `Inline _ -> () 42 42 | `Link _ -> 43 - Alcotest.failf 44 - "parse_map: child %s should be Inline, not Link" n) 43 + Alcotest.failf "parse_map: child %s should be Inline, not Link" n) 45 44 kids 46 45 | _ -> Alcotest.fail "parse_map: expected Named" 47 46 ··· 53 52 (fun i c -> 54 53 match c with 55 54 | `Inline _ -> () 56 - | `Link _ -> 57 - Alcotest.failf "parse_array: index %d should be Inline" i) 55 + | `Link _ -> Alcotest.failf "parse_array: index %d should be Inline" i) 58 56 arr 59 57 | _ -> Alcotest.fail "parse_array: expected Indexed" 60 58 ··· 63 61 match Irmin_cbor.parse sample_mixed_keys with 64 62 | Irmin.SHA256.Named [ ("text", _) ] -> () 65 63 | Irmin.SHA256.Named kids -> 66 - Alcotest.failf "expected single text-keyed child, got %d" (List.length kids) 64 + Alcotest.failf "expected single text-keyed child, got %d" 65 + (List.length kids) 67 66 | _ -> Alcotest.fail "parse_drops_non_text_keys" 68 67 69 68 let parse_invalid_is_empty () = ··· 102 101 parse_array_length_and_shape; 103 102 Alcotest.test_case "parse drops non-text keys" `Quick 104 103 parse_drops_non_text_keys; 105 - Alcotest.test_case "parse invalid -> Named []" `Quick parse_invalid_is_empty; 104 + Alcotest.test_case "parse invalid -> Named []" `Quick 105 + parse_invalid_is_empty; 106 106 Alcotest.test_case "parse scalar -> Named []" `Quick parse_scalar_is_empty; 107 107 Alcotest.test_case "roundtrip preserves member names" `Quick 108 108 roundtrip_map_shape_preserved;
+8 -12
test/json/test_irmin_json.ml
··· 2 2 3 3 Spec: 4 4 - [parse] maps JSON objects to [Named] members (name + inline value bytes), 5 - arrays to [Indexed] children (inline value bytes), and everything else 6 - to an empty [Named]. 5 + arrays to [Indexed] children (inline value bytes), and everything else to 6 + an empty [Named]. 7 7 - [serialize] is the inverse on valid shapes: [parse (serialize c)] must 8 8 equal [c] for any [c] produced by [parse]. Round-tripping is the primary 9 9 correctness property. 10 - - [schema] is recursive: every navigable child is also a JSON codec. Name 11 - is ["application/json"]. *) 10 + - [schema] is recursive: every navigable child is also a JSON codec. Name is 11 + ["application/json"]. *) 12 12 13 13 let child_pp fmt = function 14 14 | `Inline s -> Fmt.pf fmt "Inline %S" s ··· 23 23 let children_pp fmt = function 24 24 | Irmin.SHA256.Named ms -> 25 25 Fmt.pf fmt "Named [%a]" 26 - (Fmt.list ~sep:Fmt.comma 27 - (fun fmt (n, c) -> Fmt.pf fmt "%s -> %a" n child_pp c)) 26 + (Fmt.list ~sep:Fmt.comma (fun fmt (n, c) -> 27 + Fmt.pf fmt "%s -> %a" n child_pp c)) 28 28 ms 29 29 | Irmin.SHA256.Indexed arr -> 30 - Fmt.pf fmt "Indexed [|%a|]" 31 - (Fmt.array ~sep:Fmt.comma child_pp) 32 - arr 30 + Fmt.pf fmt "Indexed [|%a|]" (Fmt.array ~sep:Fmt.comma child_pp) arr 33 31 34 32 let children_equal a b = 35 33 match (a, b) with ··· 85 83 86 84 let roundtrip_object () = 87 85 (* The key property: [parse (serialize c) = c]. *) 88 - let c = 89 - Irmin.SHA256.Named [ ("k", `Inline "\"v\""); ("n", `Inline "7") ] 90 - in 86 + let c = Irmin.SHA256.Named [ ("k", `Inline "\"v\""); ("n", `Inline "7") ] in 91 87 Alcotest.check children "parse . serialize = id" c 92 88 (Irmin_json.parse (Irmin_json.serialize c)) 93 89
+6 -7
test/mime/test_irmin_mime.ml
··· 4 4 - Each exported MIME constant matches the IANA/OCI string that codecs and 5 5 [Magic_mime.lookup] agree on. 6 6 - [rules ()] returns the canonical codec-dispatch list in a stable order 7 - (same call => same list). Must include at least one rule per declared 8 - MIME (json/yaml/toml/cbor/tar/oci/text) plus gzip-wrapped patterns. *) 7 + (same call => same list). Must include at least one rule per declared MIME 8 + (json/yaml/toml/cbor/tar/oci/text) plus gzip-wrapped patterns. *) 9 9 10 - let check_mime name expected actual = Alcotest.(check string) name expected actual 10 + let check_mime name expected actual = 11 + Alcotest.(check string) name expected actual 11 12 12 13 let mime_strings () = 13 14 check_mime "json" "application/json" Irmin_mime.json; ··· 25 26 let rules_count_is_stable () = 26 27 let a = Irmin_mime.rules () in 27 28 let b = Irmin_mime.rules () in 28 - Alcotest.(check int) "same count on each call" (List.length a) 29 - (List.length b) 29 + Alcotest.(check int) "same count on each call" (List.length a) (List.length b) 30 30 31 31 let rules_include_all_declared_mimes () = 32 32 let n = List.length (Irmin_mime.rules ()) in ··· 39 39 ( "irmin_mime", 40 40 [ 41 41 Alcotest.test_case "MIME constants match spec" `Quick mime_strings; 42 - Alcotest.test_case "rules () count is stable" `Quick 43 - rules_count_is_stable; 42 + Alcotest.test_case "rules () count is stable" `Quick rules_count_is_stable; 44 43 Alcotest.test_case "rules include all built-in codecs" `Quick 45 44 rules_include_all_declared_mimes; 46 45 ] )
+3 -4
test/oci/test_irmin_oci.ml
··· 1 1 (** Tests for [Irmin_oci]. 2 2 3 3 Spec: 4 - - An OCI manifest (JSON object) parses to [Named] with one child per 5 - member. Values are re-serialized JSON kept [`Inline]. 4 + - An OCI manifest (JSON object) parses to [Named] with one child per member. 5 + Values are re-serialized JSON kept [`Inline]. 6 6 - A top-level array parses to [Indexed]. 7 7 - Invalid / non-structural JSON parses to [Named []]. 8 8 - Roundtrip: [parse (serialize c)] preserves member names. *) ··· 28 28 (fun (n, c) -> 29 29 match c with 30 30 | `Inline _ -> () 31 - | `Link _ -> 32 - Alcotest.failf "member %s should be Inline, not Link" n) 31 + | `Link _ -> Alcotest.failf "member %s should be Inline, not Link" n) 33 32 kids 34 33 | _ -> Alcotest.fail "not Named" 35 34
+5 -4
test/text/test_irmin_text.ml
··· 5 5 - [markdown] is a leaf codec named ["text/markdown"] with a line-level 6 6 merge. 7 7 - Both declare their MIME (so [Irmin.Schema.mime_rules] can pick them up). 8 - - Merge: non-overlapping edits on different lines compose cleanly; 9 - identical edits are a no-op; conflicting edits yield a [`Conflict]. *) 8 + - Merge: non-overlapping edits on different lines compose cleanly; identical 9 + edits are a no-op; conflicting edits yield a [`Conflict]. *) 10 10 11 11 let name_and_mime codec expected_name = 12 - Alcotest.(check string) (Fmt.str "%s name" expected_name) expected_name 13 - (Irmin.SHA256.name codec); 12 + Alcotest.(check string) 13 + (Fmt.str "%s name" expected_name) 14 + expected_name (Irmin.SHA256.name codec); 14 15 Alcotest.(check (option string)) 15 16 (Fmt.str "%s mime" expected_name) 16 17 (Some expected_name) (Irmin.SHA256.mime codec)
+10 -6
test/ui/test_brand.ml
··· 3 3 Spec: 4 4 - [logo] is a single anchor pointing at the site root ([href="/"]) and 5 5 contains the Irmin wordmark SVG. 6 - - The SVG carries an accessible label (["Irmin"]) so screen readers 7 - announce it. *) 6 + - The SVG carries an accessible label (["Irmin"]) so screen readers announce 7 + it. *) 8 8 9 9 let logo_is_a_single_anchor () = 10 10 let s = Tw_html.to_string Brand.logo in 11 - Alcotest.(check bool) "starts with <a" true 11 + Alcotest.(check bool) 12 + "starts with <a" true 12 13 (Astring.String.is_prefix ~affix:"<a " s); 13 - Alcotest.(check bool) "ends with </a>" true 14 + Alcotest.(check bool) 15 + "ends with </a>" true 14 16 (Astring.String.is_suffix ~affix:"</a>" s) 15 17 16 18 let logo_links_to_root () = 17 19 let s = Tw_html.to_string Brand.logo in 18 - Alcotest.(check bool) "href=\"/\"" true 20 + Alcotest.(check bool) 21 + "href=\"/\"" true 19 22 (Astring.String.is_infix ~affix:"href=\"/\"" s) 20 23 21 24 let logo_embeds_accessible_svg () = 22 25 let s = Tw_html.to_string Brand.logo in 23 26 Alcotest.(check bool) "<svg" true (Astring.String.is_infix ~affix:"<svg" s); 24 - Alcotest.(check bool) "aria-label=\"Irmin\"" true 27 + Alcotest.(check bool) 28 + "aria-label=\"Irmin\"" true 25 29 (Astring.String.is_infix ~affix:"aria-label=\"Irmin\"" s) 26 30 27 31 let suite =
+12 -10
test/ui/test_breadcrumb.ml
··· 2 2 3 3 Spec: 4 4 - Each [(label, href)] segment renders as a clickable anchor. The final 5 - segment is also clickable (per [breadcrumb.mli]), so N segments produce 6 - N anchors. 5 + segment is also clickable (per [breadcrumb.mli]), so N segments produce N 6 + anchors. 7 7 - Labels are visible as text content. 8 8 - Hrefs are emitted verbatim. *) 9 9 ··· 20 20 let anchor_count_matches_segments () = 21 21 let bc = 22 22 Breadcrumb.v 23 - ~segments: 24 - [ ("home", "/"); ("repo", "/repo/"); ("branch", "/repo/main/") ] 23 + ~segments:[ ("home", "/"); ("repo", "/repo/"); ("branch", "/repo/main/") ] 25 24 in 26 25 let s = Tw_html.to_string bc in 27 26 Alcotest.(check int) "three anchors" 3 (count_substring ~needle:"<a" s) ··· 29 28 let all_labels_visible () = 30 29 let bc = Breadcrumb.v ~segments:[ ("alpha", "/a"); ("beta", "/b") ] in 31 30 let s = Tw_html.to_string bc in 32 - Alcotest.(check bool) "alpha label present" true 31 + Alcotest.(check bool) 32 + "alpha label present" true 33 33 (Astring.String.is_infix ~affix:">alpha<" s); 34 - Alcotest.(check bool) "beta label present" true 34 + Alcotest.(check bool) 35 + "beta label present" true 35 36 (Astring.String.is_infix ~affix:">beta<" s) 36 37 37 38 let hrefs_are_emitted_verbatim () = 38 39 let bc = Breadcrumb.v ~segments:[ ("x", "/x/"); ("y", "/x/y/") ] in 39 40 let s = Tw_html.to_string bc in 40 - Alcotest.(check bool) "/x/" true 41 + Alcotest.(check bool) 42 + "/x/" true 41 43 (Astring.String.is_infix ~affix:"href=\"/x/\"" s); 42 - Alcotest.(check bool) "/x/y/" true 44 + Alcotest.(check bool) 45 + "/x/y/" true 43 46 (Astring.String.is_infix ~affix:"href=\"/x/y/\"" s) 44 47 45 48 let empty_has_no_anchors () = ··· 56 59 all_labels_visible; 57 60 Alcotest.test_case "hrefs emitted verbatim" `Quick 58 61 hrefs_are_emitted_verbatim; 59 - Alcotest.test_case "no segments -> no anchors" `Quick 60 - empty_has_no_anchors; 62 + Alcotest.test_case "no segments -> no anchors" `Quick empty_has_no_anchors; 61 63 ] ) 62 64 63 65 let () = Alcotest.run "Breadcrumb" [ suite ]
+15 -9
test/ui/test_button.ml
··· 2 2 3 3 Spec: 4 4 - [primary] / [secondary] render a [<button>] element containing their 5 - children. The primary variant visually uses the brand colour; secondary 6 - is outlined neutral. At minimum both are clickable buttons with the 7 - label text visible. 5 + children. The primary variant visually uses the brand colour; secondary is 6 + outlined neutral. At minimum both are clickable buttons with the label 7 + text visible. 8 8 - [link_primary] renders an [<a>] element (so callers supply an href), 9 9 styled like the primary button. *) 10 10 11 11 let button_renders_children () = 12 12 let s = Tw_html.to_string (Button.primary [ Tw_html.txt "Save" ]) in 13 - Alcotest.(check bool) "<button" true 13 + Alcotest.(check bool) 14 + "<button" true 14 15 (Astring.String.is_infix ~affix:"<button" s); 15 - Alcotest.(check bool) "label text" true 16 + Alcotest.(check bool) 17 + "label text" true 16 18 (Astring.String.is_infix ~affix:"Save" s) 17 19 18 20 let secondary_renders_button_tag () = 19 21 let s = Tw_html.to_string (Button.secondary [ Tw_html.txt "Cancel" ]) in 20 - Alcotest.(check bool) "<button" true 22 + Alcotest.(check bool) 23 + "<button" true 21 24 (Astring.String.is_infix ~affix:"<button" s); 22 - Alcotest.(check bool) "label text" true 25 + Alcotest.(check bool) 26 + "label text" true 23 27 (Astring.String.is_infix ~affix:"Cancel" s) 24 28 25 29 let link_primary_renders_anchor () = ··· 30 34 [ Tw_html.txt "Sign in" ]) 31 35 in 32 36 Alcotest.(check bool) "<a" true (Astring.String.is_infix ~affix:"<a" s); 33 - Alcotest.(check bool) "href=/signin" true 37 + Alcotest.(check bool) 38 + "href=/signin" true 34 39 (Astring.String.is_infix ~affix:"href=\"/signin\"" s); 35 - Alcotest.(check bool) "label text" true 40 + Alcotest.(check bool) 41 + "label text" true 36 42 (Astring.String.is_infix ~affix:"Sign in" s) 37 43 38 44 let primary_and_secondary_are_visually_distinct () =
+20 -13
test/ui/test_drop_zone.ml
··· 2 2 3 3 Spec: 4 4 - Renders a [<form>] with: 5 - - [action] equal to [upload_url] 6 - - [method="POST"] 7 - - [enctype="multipart/form-data"] 5 + - [action] equal to [upload_url] 6 + - [method="POST"] 7 + - [enctype="multipart/form-data"] 8 8 - Carries a hidden [<input>] named [dir] whose value is [target_dir]. 9 9 - Exposes a [<input type="file">] for selecting files. 10 10 - The file input auto-submits the form on change (so no JS framework is ··· 15 15 16 16 let form_post_action_enctype () = 17 17 let s = form ~upload_url:"/branch/upload" ~target_dir:"sub" in 18 - Alcotest.(check bool) "<form" true 19 - (Astring.String.is_infix ~affix:"<form" s); 20 - Alcotest.(check bool) "action" true 18 + Alcotest.(check bool) "<form" true (Astring.String.is_infix ~affix:"<form" s); 19 + Alcotest.(check bool) 20 + "action" true 21 21 (Astring.String.is_infix ~affix:"action=\"/branch/upload\"" s); 22 - Alcotest.(check bool) "POST" true 22 + Alcotest.(check bool) 23 + "POST" true 23 24 (Astring.String.is_infix ~affix:"method=\"POST\"" s); 24 - Alcotest.(check bool) "multipart" true 25 + Alcotest.(check bool) 26 + "multipart" true 25 27 (Astring.String.is_infix ~affix:"enctype=\"multipart/form-data\"" s) 26 28 27 29 let hidden_dir_carries_target () = 28 30 let s = form ~upload_url:"/u" ~target_dir:"docs/src" in 29 - Alcotest.(check bool) "hidden dir input" true 31 + Alcotest.(check bool) 32 + "hidden dir input" true 30 33 (Astring.String.is_infix ~affix:"type=\"hidden\"" s); 31 - Alcotest.(check bool) "name=dir" true 34 + Alcotest.(check bool) 35 + "name=dir" true 32 36 (Astring.String.is_infix ~affix:"name=\"dir\"" s); 33 - Alcotest.(check bool) "value=target" true 37 + Alcotest.(check bool) 38 + "value=target" true 34 39 (Astring.String.is_infix ~affix:"value=\"docs/src\"" s) 35 40 36 41 let file_input_present_with_auto_submit () = 37 42 let s = form ~upload_url:"/u" ~target_dir:"" in 38 - Alcotest.(check bool) "file input" true 43 + Alcotest.(check bool) 44 + "file input" true 39 45 (Astring.String.is_infix ~affix:"type=\"file\"" s); 40 - Alcotest.(check bool) "auto-submit on change" true 46 + Alcotest.(check bool) 47 + "auto-submit on change" true 41 48 (Astring.String.is_infix ~affix:"dispatchEvent" s) 42 49 43 50 let suite =
+31 -25
test/ui/test_layout.ml
··· 3 3 Spec: 4 4 - [page ~title ~auth content] produces a [Tw_html.page] whose HTML 5 5 rendering: 6 - - has a [<title>] matching [title]; 7 - - contains the content elements; 8 - - renders auth controls per [auth]: 9 - * [Off]: no sign-in button, no avatar; 10 - * [Anon]: a "Sign in with GitHub" control, no avatar; 11 - * [Signed_in {email; name; ...}]: displays the user's name (or 12 - email fallback when name is empty) and a sign-out form. 6 + - has a [<title>] matching [title]; 7 + - contains the content elements; 8 + - renders auth controls per [auth]: * [Off]: no sign-in button, no avatar; * 9 + [Anon]: a "Sign in with GitHub" control, no avatar; * 10 + [Signed_in {email; name; ...}]: displays the user's name (or email 11 + fallback when name is empty) and a sign-out form. 13 12 - [title_h1 text] renders an [<h1>] containing [text]. 14 13 - [summary text] renders a paragraph containing [text]. *) 15 14 ··· 18 17 19 18 let title_wires_through_to_head () = 20 19 let s = render ~title:"Hello World" ~auth:Layout.Off [] in 21 - Alcotest.(check bool) "<title>...</title>" true 20 + Alcotest.(check bool) 21 + "<title>...</title>" true 22 22 (Astring.String.is_infix ~affix:"<title>Hello World</title>" s) 23 23 24 24 let content_is_rendered () = 25 25 let marker = Tw_html.txt "<<<unique-content-marker>>>" in 26 26 let s = render ~title:"t" ~auth:Layout.Off [ marker ] in 27 - Alcotest.(check bool) "content visible" true 28 - (Astring.String.is_infix ~affix:"&lt;&lt;&lt;unique-content-marker&gt;&gt;&gt;" s 27 + Alcotest.(check bool) 28 + "content visible" true 29 + (Astring.String.is_infix 30 + ~affix:"&lt;&lt;&lt;unique-content-marker&gt;&gt;&gt;" s 29 31 || Astring.String.is_infix ~affix:"<<<unique-content-marker>>>" s) 30 32 31 33 let auth_off_has_no_signin () = 32 34 let s = render ~title:"t" ~auth:Layout.Off [] in 33 - Alcotest.(check bool) "no 'Sign in'" false 35 + Alcotest.(check bool) 36 + "no 'Sign in'" false 34 37 (Astring.String.is_infix ~affix:"Sign in" s) 35 38 36 39 let auth_anon_shows_signin () = 37 40 let s = render ~title:"t" ~auth:Layout.Anon [] in 38 - Alcotest.(check bool) "Sign in" true 41 + Alcotest.(check bool) 42 + "Sign in" true 39 43 (Astring.String.is_infix ~affix:"Sign in" s) 40 44 41 45 let auth_signed_in_shows_name () = ··· 46 50 { email = "alice@ex.com"; name = "Alice"; avatar_url = "" }) 47 51 [] 48 52 in 49 - Alcotest.(check bool) "name visible" true 53 + Alcotest.(check bool) 54 + "name visible" true 50 55 (Astring.String.is_infix ~affix:"Alice" s); 51 - Alcotest.(check bool) "Sign out form" true 56 + Alcotest.(check bool) 57 + "Sign out form" true 52 58 (Astring.String.is_infix ~affix:"Sign out" s) 53 59 54 60 let auth_signed_in_email_fallback () = ··· 56 62 let s = 57 63 render ~title:"t" 58 64 ~auth: 59 - (Layout.Signed_in 60 - { email = "bob@ex.com"; name = ""; avatar_url = "" }) 65 + (Layout.Signed_in { email = "bob@ex.com"; name = ""; avatar_url = "" }) 61 66 [] 62 67 in 63 - Alcotest.(check bool) "email fallback visible" true 68 + Alcotest.(check bool) 69 + "email fallback visible" true 64 70 (Astring.String.is_infix ~affix:"bob@ex.com" s) 65 71 66 72 let title_h1_wraps_text () = 67 73 let s = Tw_html.to_string (Layout.title_h1 "Heading") in 68 - Alcotest.(check bool) "<h1" true 69 - (Astring.String.is_infix ~affix:"<h1" s); 70 - Alcotest.(check bool) "heading text" true 74 + Alcotest.(check bool) "<h1" true (Astring.String.is_infix ~affix:"<h1" s); 75 + Alcotest.(check bool) 76 + "heading text" true 71 77 (Astring.String.is_infix ~affix:"Heading" s) 72 78 73 79 let summary_is_a_paragraph () = 74 80 let s = Tw_html.to_string (Layout.summary "Short description.") in 75 - Alcotest.(check bool) "<p" true 76 - (Astring.String.is_infix ~affix:"<p" s); 77 - Alcotest.(check bool) "summary text" true 81 + Alcotest.(check bool) "<p" true (Astring.String.is_infix ~affix:"<p" s); 82 + Alcotest.(check bool) 83 + "summary text" true 78 84 (Astring.String.is_infix ~affix:"Short description." s) 79 85 80 86 let suite = ··· 89 95 Alcotest.test_case "Anon shows Sign in" `Quick auth_anon_shows_signin; 90 96 Alcotest.test_case "Signed_in shows name + sign-out" `Quick 91 97 auth_signed_in_shows_name; 92 - Alcotest.test_case "Signed_in falls back to email when name empty" 93 - `Quick auth_signed_in_email_fallback; 98 + Alcotest.test_case "Signed_in falls back to email when name empty" `Quick 99 + auth_signed_in_email_fallback; 94 100 Alcotest.test_case "title_h1 wraps its text in <h1>" `Quick 95 101 title_h1_wraps_text; 96 102 Alcotest.test_case "summary wraps its text in <p>" `Quick
+18 -17
test/ui/test_table.ml
··· 1 1 (** Tests for [Table]. 2 2 3 3 Spec: 4 - - [head cols] renders a [<thead>] with one [<th>] per column, each 5 - showing the column's label. 4 + - [head cols] renders a [<thead>] with one [<th>] per column, each showing 5 + the column's label. 6 6 - [row cells] renders a [<tr>] containing the given cells. 7 7 - [cell] renders [<td>]. 8 8 - [dim_cell] / [mono_cell] are specialised [<td>]s carrying their text. ··· 35 35 36 36 let row_is_a_tr () = 37 37 let s = Tw_html.to_string (Table.row [ Table.cell [ Tw_html.txt "x" ] ]) in 38 - Alcotest.(check bool) "<tr" true 39 - (Astring.String.is_infix ~affix:"<tr" s); 40 - Alcotest.(check bool) "<td" true 41 - (Astring.String.is_infix ~affix:"<td" s); 42 - Alcotest.(check bool) "cell content" true 38 + Alcotest.(check bool) "<tr" true (Astring.String.is_infix ~affix:"<tr" s); 39 + Alcotest.(check bool) "<td" true (Astring.String.is_infix ~affix:"<td" s); 40 + Alcotest.(check bool) 41 + "cell content" true 43 42 (Astring.String.is_infix ~affix:">x<" s) 44 43 45 44 let dim_and_mono_cells_render_text () = 46 45 let d = Tw_html.to_string (Table.dim_cell "—") in 47 46 let m = Tw_html.to_string (Table.mono_cell "abcdef0") in 48 47 Alcotest.(check bool) "dim text" true (Astring.String.is_infix ~affix:"—" d); 49 - Alcotest.(check bool) "mono text" true 48 + Alcotest.(check bool) 49 + "mono text" true 50 50 (Astring.String.is_infix ~affix:"abcdef0" m); 51 - Alcotest.(check bool) "dim differs from mono" true 52 - (not (String.equal d m)) 51 + Alcotest.(check bool) "dim differs from mono" true (not (String.equal d m)) 53 52 54 53 let wrap_produces_table_tag () = 55 54 let s = ··· 58 57 ~head:(Table.head [ ("c", Table.Left) ]) 59 58 [ Table.row [ Table.cell [ Tw_html.txt "r" ] ] ]) 60 59 in 61 - Alcotest.(check bool) "<table" true 60 + Alcotest.(check bool) 61 + "<table" true 62 62 (Astring.String.is_infix ~affix:"<table" s); 63 - Alcotest.(check bool) "contains head" true 63 + Alcotest.(check bool) 64 + "contains head" true 64 65 (Astring.String.is_infix ~affix:"<th" s); 65 - Alcotest.(check bool) "contains row" true 66 + Alcotest.(check bool) 67 + "contains row" true 66 68 (Astring.String.is_infix ~affix:"<tr" s) 67 69 68 70 let suite = 69 71 ( "table", 70 72 [ 71 - Alcotest.test_case "head: one <th> per column, all labels visible" 72 - `Quick head_has_one_th_per_column; 73 - Alcotest.test_case "row is a <tr> containing its cells" `Quick 74 - row_is_a_tr; 73 + Alcotest.test_case "head: one <th> per column, all labels visible" `Quick 74 + head_has_one_th_per_column; 75 + Alcotest.test_case "row is a <tr> containing its cells" `Quick row_is_a_tr; 75 76 Alcotest.test_case "dim_cell and mono_cell render distinctly" `Quick 76 77 dim_and_mono_cells_render_text; 77 78 Alcotest.test_case "wrap yields a <table> containing head + rows" `Quick
+4 -2
test/ui/test_tag.ml
··· 8 8 9 9 let v_renders_text () = 10 10 let s = Tw_html.to_string (Tag.v "preview") in 11 - Alcotest.(check bool) "label visible" true 11 + Alcotest.(check bool) 12 + "label visible" true 12 13 (Astring.String.is_infix ~affix:"preview" s) 13 14 14 15 let mono_renders_text () = 15 16 let s = Tw_html.to_string (Tag.mono "abcd1234") in 16 - Alcotest.(check bool) "label visible" true 17 + Alcotest.(check bool) 18 + "label visible" true 17 19 (Astring.String.is_infix ~affix:"abcd1234" s) 18 20 19 21 let tones_are_visually_distinct () =
+3 -4
test/yaml/test_irmin_yaml.ml
··· 5 5 Non-string-keyed entries are dropped silently. 6 6 - A YAML sequence yields [Indexed] children. 7 7 - Scalar input yields [Named []]. 8 - - [parse (serialize c) = c] on member names (YAML re-emission may 9 - reformat values but must preserve the logical member set). *) 8 + - [parse (serialize c) = c] on member names (YAML re-emission may reformat 9 + values but must preserve the logical member set). *) 10 10 11 11 let parse_mapping_exact_names () = 12 12 match Irmin_yaml.parse "name: alice\nage: 30\n" with ··· 23 23 (fun i c -> 24 24 match c with 25 25 | `Inline _ -> () 26 - | `Link _ -> 27 - Alcotest.failf "sequence index %d should be Inline" i) 26 + | `Link _ -> Alcotest.failf "sequence index %d should be Inline" i) 28 27 arr 29 28 | _ -> Alcotest.fail "parse_sequence_exact_length" 30 29