ocaml-core / base / core / lib_test /

open Core.Std;;
open OUnit;;

let rec count acc = function
  | TestCase _ -> acc + 1
  | TestLabel (_,test) -> count acc test
  | TestList l ->
    List.fold_left l

let count_pa_ounit = function
  | TestList l ->
    List.fold_left l
      ~f:(fun (pa_ounit,total) test ->
        match test with
        | TestLabel (s,tst) when String.is_suffix ~suffix:".ml" s ->
          let cnt = count 0 tst in
        | test ->
          pa_ounit,count total test)
  | v ->
    0,count 0 v

let main () =
  let cnt_ounit =
     Arg.Unit (fun () ->
       let pa_ounit,total = count_pa_ounit (Test.all ()) in
       Printf.printf "converted: %i total: %i\n%!" pa_ounit total;
       exit 0
     " Count how many of the tests were converted to pa_ounit (for \
 informational purposes only)"
  ignore (run_test_tt_main
            (Test.all ()):OUnit.test_result list)
let () = Core.Exn.handle_uncaught ~exit:true main
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.