mirror of
https://git.sr.ht/~bryan_bennett/flake_env
synced 2025-12-18 15:31:24 +01:00
Add tests
This commit is contained in:
parent
7759d2ac6a
commit
04109672f0
8 changed files with 403 additions and 2 deletions
41
tests/flake_env_test_watches.re
Normal file
41
tests/flake_env_test_watches.re
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
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),
|
||||
])
|
||||
]),
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue