diff options
Diffstat (limited to 'tests/confLoader.ml')
-rw-r--r-- | tests/confLoader.ml | 72 |
1 files changed, 1 insertions, 71 deletions
diff --git a/tests/confLoader.ml b/tests/confLoader.ml index bce4db0..4adedd6 100644 --- a/tests/confLoader.ml +++ b/tests/confLoader.ml @@ -1,5 +1,3 @@ -open StdLabels - (** Read the configuration in toml and return the internal representation *) let load : string -> ImportConf.Syntax.t = fun content -> @@ -7,9 +5,7 @@ let load : string -> ImportConf.Syntax.t = let conf = load - {|version = 1 - -[source] + {|[source] file = "source.xlsx" name = "source" @@ -60,69 +56,3 @@ let external_last = allow_missing = true; match_rule = None; } - -let show_source (source : ImportDataTypes.Table.t) = - Printf.sprintf "%s:%d" source.ImportDataTypes.Table.file - source.ImportDataTypes.Table.tab - -(* - * Compare two external sources - *) - -let show_sources sources = - let b = Buffer.create 16 in - Buffer.add_string b "["; - List.iter sources ~f:(fun source -> - Buffer.add_string b (show_source source); - Buffer.add_string b ","); - - let len = Buffer.length b in - if len > 1 then Buffer.truncate b (len - 1); - Buffer.add_string b "]"; - - Buffer.contents b - -and cmp_source : ImportDataTypes.Table.t -> ImportDataTypes.Table.t -> bool = - fun s1 s2 -> - String.equal s1.ImportDataTypes.Table.name s2.ImportDataTypes.Table.name - && String.equal s1.ImportDataTypes.Table.file s2.ImportDataTypes.Table.file - && s1.ImportDataTypes.Table.tab = s2.ImportDataTypes.Table.tab - -let cmp_list : ('a -> 'a -> bool) -> 'a list -> 'a list -> bool = - fun cmp elems1 elems2 -> List.for_all2 ~f:cmp elems1 elems2 - -(* - * Compare keys in the dependencies - *) - -let key_printer : ImportAnalyser.Dependency.key -> string = - fun { name; expression; _ } -> - let path_name = - let buffer = Buffer.create 16 in - ImportExpression.Headers.headers_of_expression buffer - (fun col buffer -> - Buffer.add_string buffer (ImportCSV.Csv.column_to_string col)) - expression; - Buffer.contents buffer - in - Printf.sprintf "%s, %s" name path_name - -and key_cmp a b = - 0 - = ImportExpression.T.cmp - (fun a b -> a - b) - a.ImportAnalyser.Dependency.expression - b.ImportAnalyser.Dependency.expression - -let keys_printer : ImportAnalyser.Dependency.key list -> string = - fun contents -> - let b = Buffer.create 16 in - List.iter contents ~f:(fun v -> Buffer.add_string b (key_printer v)); - Buffer.contents b - -(* - * Represents externals - *) - -let pp_externals : ImportConf.Syntax.Extern.t list -> string = - fun ext -> ImportConf.Syntax.Extern.toml ext |> Otoml.Printer.to_string |