let name = __FILE__ let description = "Check the [Model.Identifier] module: validation of the names given as \ arguments, their quoted SQL form, the predefined columns and the composite \ names" let speclist () = [] type t = string list let pp : Format.formatter -> t -> unit = Format.pp_print_list ~pp_sep:Format.pp_print_newline Format.pp_print_string (** A valid name is printed in its quoted SQL form, an invalid one is reported *) let check : string -> string = fun s -> match Model.Identifier.of_string_opt s with | Some id -> Model.Identifier.quote id | None -> "invalid: \"" ^ s ^ "\"" let exec : string list -> t = fun args -> (* The anonymous arguments are collected in reverse order by the test harness *) match List.rev args with | "check" :: names -> List.map check names | "predefined" :: [] -> [ "id = " ^ Model.Identifier.quote Model.Identifier.id; "parent = " ^ Model.Identifier.quote Model.Identifier.parent; "target = " ^ Model.Identifier.quote Model.Identifier.target; ] | "dot" :: [ a; b ] -> [ Model.Identifier.quote (Model.Identifier.dot (Model.Identifier.of_string a) (Model.Identifier.of_string b)); ] | _ -> failwith "Invalid arguments"