Skip to content

Commit b3d436b

Browse files
committed
tests/plugins-by-name: test that required files exist
1 parent ff87a9e commit b3d436b

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tests/plugins-by-name.nix

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,45 @@ linkFarmFromDrvs "plugins-by-name" [
8787
''
8888
)
8989

90+
# Check default.nix files exist for each directory
91+
(runCommandNoCCLocal "default-nix-exists"
92+
{
93+
__structuredAttrs = true;
94+
missingPlugins = builtins.filter (
95+
name: !(builtins.pathExists "${by-name}/${name}/default.nix")
96+
) children.directory;
97+
missingTests = builtins.filter (
98+
name: !(builtins.pathExists "${./test-sources/plugins/by-name}/${name}/default.nix")
99+
) children.directory;
100+
}
101+
''
102+
declare -i errs=0
103+
104+
if (( ''${#missingPlugins[@]} > 0 )); then
105+
((++errs))
106+
echo "The following (''${#missingPlugins[@]}) directories do not have a default.nix file:"
107+
for name in "''${missingPlugins[@]}"; do
108+
echo " - plugins/by-name/$name"
109+
done
110+
echo
111+
fi
112+
113+
if (( ''${#missingTests[@]} > 0 )); then
114+
((++errs))
115+
echo "The following (''${#missingTests[@]}) test files do not exist:"
116+
for name in "''${missingTests[@]}"; do
117+
echo " - tests/test-sources/plugins/by-name/$name/default.nix"
118+
done
119+
echo
120+
fi
121+
122+
if (( $errs > 0 )); then
123+
exit $errs
124+
fi
125+
touch $out
126+
''
127+
)
128+
90129
# Ensures all plugin enable options are declared in a directory matching the plugin name
91130
(runCommandNoCCLocal "mismatched-plugin-names"
92131
{

0 commit comments

Comments
 (0)