Module Clerk_driver

module Nj = Ninja_utils

Command line interface

val files_or_folders : string list Cmdliner.Term.t
val command : string Cmdliner.Term.t
val debug : bool Cmdliner.Term.t
val reset_test_outputs : bool Cmdliner.Term.t
val catalac : string option Cmdliner.Term.t
val ninja_output : string option Cmdliner.Term.t
val scope : string option Cmdliner.Term.t
val makeflags : string option Cmdliner.Term.t
val catala_opts : string option Cmdliner.Term.t
val clerk_t : ( string list -> string -> string option -> string option -> string option -> bool -> string option -> bool -> string option -> 'a ) -> 'a Cmdliner.Term.t
val version : string
val info : Cmdliner.Cmd.info

Testing

type expected_output_descr = {
tested_filename : string;(*

Name of the file that's being tested

*)
output_dir : string;(*

Name of the output directory where all expected outputs are stored

*)
id : string;(*

Id of this precise unit test that will be associated to an expected output

*)
cmd : string;(*

Catala command to launch to run the test, excluding "catala" at the begin, and the name of the file to test

*)
}
val catala_suffix_regex : Re.Pcre.regexp
val readdir_sort : string -> string array

readdir_sort dirname returns the sorted subdirectories of dirname in an array or an empty array if the dirname doesn't exist.

type test = {
text_before : string;(*

Verbatim of everything from the last test end or beginning of file up to the test output start

*)
params : string list;(*

Catala command-line arguments for the test

*)
}
type file_tests = {
tests : test list;
text_after : string;(*

Verbatim of everything following the last test

*)
}
val inline_test_start_key : string
val has_inline_tests : string -> bool
val scan_for_inline_tests : string -> file_tests option
val search_for_expected_outputs : string -> expected_output_descr list

Given a file, looks in the relative output directory if there are files with the same base name that contain expected outputs for different

module Var : sig ... end

Var references used in the Clerk file

val pipe_diff_cmd : Nj.Expr.t
val inline_test_rule : string -> string -> Nj.Rule.t
val inline_reset_rule : string -> string -> Nj.Rule.t
val add_reset_rules_aux : redirect:string -> rule_name:string -> string -> Ninja_utils.Rule.t Nj.RuleMap.t -> Ninja_utils.Rule.t Nj.RuleMap.t
val add_test_rules_aux : rule_name:string -> string -> Ninja_utils.Rule.t Nj.RuleMap.t -> Ninja_utils.Rule.t Nj.RuleMap.t
val add_reset_rules : string -> Ninja_utils.Rule.t Nj.RuleMap.t -> Ninja_utils.Rule.t Nj.RuleMap.t

add_reset_rules catala_exe_opts rules adds ninja rules used to reset test files into rules and returns it.

val add_test_rules : string -> Ninja_utils.Rule.t Nj.RuleMap.t -> Ninja_utils.Rule.t Nj.RuleMap.t

add_test_rules catala_exe_opts rules adds ninja rules used to test files into rules and returns it.

val ninja_start : string -> string -> Ninja_utils.ninja

ninja_start catala_exe returns the inital ninja data structure with rules needed to reset and test files.

val collect_inline_ninja_builds : Ninja_utils.ninja -> string -> bool -> (string * Ninja_utils.ninja) option
val collect_all_ninja_build : Ninja_utils.ninja -> string -> bool -> (string * Ninja_utils.ninja) option

collect_all_ninja_build ninja tested_file catala_exe catala_opts reset_test_outputs creates and returns all ninja build statements needed to test the tested_file.

val add_root_test_build : Ninja_utils.ninja -> string list -> string -> Ninja_utils.ninja

add_root_test_build ninja all_file_names all_test_builds add the 'test' ninja build declaration calling the rule 'run_and_display_final_message' for all_test_builds which correspond to all_file_names.

val run_inline_tests : reset:bool -> string -> string -> string list -> unit

Directly runs the test (not using ninja, this will be called by ninja rules through the "clerk runtest" command)

Running

val run_file : string -> string -> string -> string -> int

Driver

val get_catala_files_in_folder : string -> string list
type ninja_building_context = {
last_valid_ninja : Ninja_utils.ninja;
curr_ninja : Ninja_utils.ninja option;
all_file_names : string list;
all_test_builds : string;
all_failed_names : string list;
}

Record used to keep tracks of the current context while building the Ninja_utils.ninja.

val ninja_building_context_init : Nj.ninja -> ninja_building_context

ninja_building_context_init ninja_init returns the empty context corresponding to ninja_init.

val collect_in_folder : ninja_building_context -> string -> Nj.ninja -> bool -> ninja_building_context

collect_in_directory ctx file_or_folder ninja_start reset_test_outputs updates the building context ctx by adding new ninja build statements needed to test files in folder.

val collect_in_file : ninja_building_context -> string -> Nj.ninja -> bool -> ninja_building_context

collect_in_file ctx file_or_folder ninja_start reset_test_outputs updates the building context ctx by adding new ninja build statements needed to test the tested_file.

Return code values

val return_ok : int
val return_err : int

Driver

val add_test_builds : ninja_building_context -> string list -> bool -> ninja_building_context

add_root_test_build ctx files_or_folders reset_test_outputs updates the ctx by adding ninja build statements needed to test or reset_test_outputs files_or_folders.

val makeflags_to_ninja_flags : string option -> string
val driver : string list -> string -> string option -> string option -> string option -> bool -> string option -> bool -> string option -> int
val main : unit -> 'a