2022-12-15 20:05:02 +00:00
|
|
|
{ runCommandLocal
|
|
|
|
, git
|
|
|
|
, clang-tools
|
|
|
|
, makeHardcodeGsettingsPatch
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
mkTest =
|
|
|
|
{
|
|
|
|
name,
|
|
|
|
expected,
|
|
|
|
src,
|
|
|
|
schemaIdToVariableMapping,
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
patch = makeHardcodeGsettingsPatch {
|
|
|
|
inherit src schemaIdToVariableMapping;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
runCommandLocal
|
|
|
|
"makeHardcodeGsettingsPatch-tests-${name}"
|
|
|
|
|
|
|
|
{
|
|
|
|
nativeBuildInputs = [
|
|
|
|
git
|
|
|
|
clang-tools
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
''
|
|
|
|
cp -r --no-preserve=all "${src}" src
|
|
|
|
cp -r --no-preserve=all "${expected}" src-expected
|
|
|
|
|
|
|
|
pushd src
|
|
|
|
patch < "${patch}"
|
|
|
|
popd
|
|
|
|
|
|
|
|
find src -name '*.c' -print0 | while read -d $'\0' sourceFile; do
|
|
|
|
sourceFile=''${sourceFile#src/}
|
|
|
|
clang-format -style='{BasedOnStyle: InheritParentConfig, ColumnLimit: 240}' -i "src/$sourceFile" "src-expected/$sourceFile"
|
|
|
|
git diff --no-index "src/$sourceFile" "src-expected/$sourceFile" | cat
|
|
|
|
done
|
|
|
|
touch "$out"
|
|
|
|
'';
|
|
|
|
in
|
|
|
|
{
|
|
|
|
basic = mkTest {
|
|
|
|
name = "basic";
|
|
|
|
src = ./fixtures/example-project;
|
|
|
|
schemaIdToVariableMapping = {
|
|
|
|
"org.gnome.evolution-data-server.addressbook" = "EDS";
|
|
|
|
"org.gnome.evolution.calendar" = "EVO";
|
2022-12-15 20:20:40 +00:00
|
|
|
"org.gnome.seahorse.nautilus.window" = "SEANAUT";
|
2022-12-15 20:05:02 +00:00
|
|
|
};
|
|
|
|
expected = ./fixtures/example-project-patched;
|
|
|
|
};
|
|
|
|
}
|