mirror of
https://git.sr.ht/~bryan_bennett/flake_env
synced 2025-12-16 14:41:24 +01:00
41 lines
963 B
ReasonML
41 lines
963 B
ReasonML
open Lib.Watches;
|
|
|
|
let test_get_path_removes_prefix = () => {
|
|
let input = `Assoc([
|
|
("path", `String("aaaaaaaaaaabbbbb"))
|
|
]);
|
|
Alcotest.(check(string))("Prefix removed", "bbbbb", get_path(input))
|
|
};
|
|
|
|
let test_get_paths_from_doc = () => {
|
|
let input = `Assoc([
|
|
("path", `String("aaaaaaaaaaabbbbb")),
|
|
("inputs", `Assoc([
|
|
("foo", `Assoc([
|
|
("path", `String("aaaaaaaaaaaccccc")),
|
|
("inputs", `Assoc([
|
|
("bar", `Assoc([
|
|
("path", `String("aaaaaaaaaaaddddd")),
|
|
("inputs", `Assoc([]))
|
|
]))
|
|
]))
|
|
]))
|
|
]))
|
|
]);
|
|
Alcotest.(check(list(string)))("Gathers all inputs", ["bbbbb", "ccccc", "ddddd"], get_paths_from_doc(input, []))
|
|
};
|
|
|
|
let () =
|
|
Alcotest.(
|
|
run(
|
|
"Watches",
|
|
[("get_path",
|
|
[
|
|
test_case("Removes prefix", `Quick, test_get_path_removes_prefix),
|
|
]),
|
|
("get_paths_from_doc",
|
|
[
|
|
test_case("Collects all paths", `Quick, test_get_paths_from_doc),
|
|
])
|
|
]),
|
|
);
|