aboutsummaryrefslogtreecommitdiff
path: root/tests/confLoader.ml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/confLoader.ml')
-rw-r--r--tests/confLoader.ml26
1 files changed, 22 insertions, 4 deletions
diff --git a/tests/confLoader.ml b/tests/confLoader.ml
index 13f9840..b0be690 100644
--- a/tests/confLoader.ml
+++ b/tests/confLoader.ml
@@ -1,5 +1,23 @@
-let load' : string -> (ImporterSyntax.t, string) Result.t =
- fun content -> Otoml.Parser.from_string content |> ImportConf.t_of_toml
+(** During the test, we don’t care with the file existence *)
+let context =
+ ImportConf.
+ { loadFile = (fun _ -> Otoml.array []); checkFile = (fun _ -> true) }
+
+let load' :
+ ?dataset:(string -> Otoml.t) ->
+ string ->
+ (ImporterSyntax.t, string) Result.t =
+ fun ?(dataset = fun _ -> Otoml.array []) content ->
+ let toml = Otoml.Parser.from_string content in
+ ImportConf.t_of_toml toml ~context:{ context with loadFile = dataset }
+
+let load_from_file :
+ ?dataset:(string -> Otoml.t) ->
+ string ->
+ (ImporterSyntax.t, string) Result.t =
+ fun ?(dataset = fun _ -> Otoml.array []) content ->
+ let toml = Otoml.Parser.from_file content in
+ ImportConf.t_of_toml toml ~context:{ context with loadFile = dataset }
(** Read the configuration in toml and return the internal representation *)
let load : string -> ImporterSyntax.t =
@@ -43,7 +61,7 @@ let external_other =
target = external_table_other;
extern_key = Path 3;
allow_missing = false;
- match_rule = None;
+ filters = [];
}
let external_table_last =
@@ -56,5 +74,5 @@ let external_last =
target = external_table_last;
extern_key = Path 3;
allow_missing = true;
- match_rule = None;
+ filters = [];
}