nix-community.nixvim/tests/extend.nix
Matt Sturgeon 036e11665f
tests: cleanup tests to better use callTest pattern
e.g. Prefer taking `pkgs.*` attrs directly as function arguments.
2024-10-18 20:52:02 +01:00

27 lines
647 B
Nix

{
makeNixvimWithModule,
runCommandNoCCLocal,
}:
let
firstStage = makeNixvimWithModule {
module = {
extraConfigLua = "-- first stage";
};
};
secondStage = firstStage.extend { extraConfigLua = "-- second stage"; };
generated = secondStage.extend { extraConfigLua = "-- third stage"; };
in
runCommandNoCCLocal "extend-test" { printConfig = "${generated}/bin/nixvim-print-init"; } ''
config=$($printConfig)
for stage in "first" "second" "third"; do
if ! "$printConfig" | grep -q -- "-- $stage stage"; then
echo "Missing $stage stage in config"
echo "$config"
exit 1
fi
done
touch $out
''