• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ocaml / odoc / 2403

02 Oct 2024 03:15PM UTC coverage: 72.971% (+0.1%) from 72.848%
2403

Pull #1193

github

web-flow
Merge 93aa604a2 into 0ba1fdbe6
Pull Request #1193: Specify children order in frontmatter

140 of 154 new or added lines in 10 files covered. (90.91%)

60 existing lines in 5 files now uncovered.

10248 of 14044 relevant lines covered (72.97%)

2965.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.0
/src/model/frontmatter.ml
1
type child = Page of string | Dir of string
2

3
type line = Children_order of child list | KV of string * string | V of string
4

5
type t = { children_order : child list Location_.with_location option }
6

7
let empty = { children_order = None }
8

9
let apply fm line =
10
  match (line.Location_.value, fm) with
5✔
11
  | Children_order children_order, { children_order = None } ->
2✔
12
      { children_order = Some (Location_.same line children_order) }
2✔
NEW
13
  | Children_order _, { children_order = Some _ } ->
×
14
      (* TODO raise warning about duplicate children field *) fm
NEW
15
  | KV _, _ | V _, _ -> (* TODO raise warning *) fm
×
16

17
let parse_child c =
18
  if Astring.String.is_suffix ~affix:"/" c then
5✔
19
    let c = String.sub c 0 (String.length c - 1) in
1✔
20
    Dir c
1✔
21
  else Page c
4✔
22

23
let parse s =
24
  let entries =
4✔
25
    s.Location_.value
26
    |> Astring.String.cuts ~sep:"\n"
27
    |> List.map (fun l ->
4✔
28
           let v =
5✔
29
             Astring.String.cut ~sep:":" l |> function
5✔
30
             | Some ("children", v) ->
2✔
31
                 let refs =
32
                   v
33
                   |> Astring.String.fields ~empty:false
34
                   |> List.map parse_child
2✔
35
                 in
36
                 Children_order refs
2✔
37
             | Some (k, v) -> KV (k, v)
3✔
NEW
38
             | None -> V l
×
39
           in
40
           Location_.same s v)
5✔
41
  in
42
  List.fold_left apply empty entries
4✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc