1{ runCommandLocal
2, git
3, clang-tools
4, makeHardcodeGsettingsPatch
5}:
6
7let
8 mkTest =
9 {
10 name,
11 expected,
12 src,
13 schemaIdToVariableMapping,
14 }:
15
16 let
17 patch = makeHardcodeGsettingsPatch {
18 inherit src schemaIdToVariableMapping;
19 };
20 in
21 runCommandLocal
22 "makeHardcodeGsettingsPatch-tests-${name}"
23
24 {
25 nativeBuildInputs = [
26 git
27 clang-tools
28 ];
29 }
30
31 ''
32 cp -r --no-preserve=all "${src}" src
33 cp -r --no-preserve=all "${expected}" src-expected
34
35 pushd src
36 patch < "${patch}"
37 popd
38
39 find src -name '*.c' -print0 | while read -d $'\0' sourceFile; do
40 sourceFile=''${sourceFile#src/}
41 clang-format -style='{BasedOnStyle: InheritParentConfig, ColumnLimit: 240}' -i "src/$sourceFile" "src-expected/$sourceFile"
42 git diff --no-index "src/$sourceFile" "src-expected/$sourceFile" | cat
43 done
44 touch "$out"
45 '';
46in
47{
48 basic = mkTest {
49 name = "basic";
50 src = ./fixtures/example-project;
51 schemaIdToVariableMapping = {
52 "org.gnome.evolution-data-server.addressbook" = "EDS";
53 "org.gnome.evolution.calendar" = "EVO";
54 "org.gnome.seahorse.nautilus.window" = "SEANAUT";
55 };
56 expected = ./fixtures/example-project-patched;
57 };
58}