typioca: 2.7.0 -> 2.8.0
[NixPkgs.git] / pkgs / test / make-hardcode-gsettings-patch / default.nix
blob6c5d2318c6d8c637798bcbd3531d4cf09da7252f
1 { runCommandLocal
2 , git
3 , clang-tools
4 , makeHardcodeGsettingsPatch
5 }:
7 let
8   mkTest =
9     {
10       name,
11       expected,
12       src,
13       schemaIdToVariableMapping,
14     }:
16     let
17       patch = makeHardcodeGsettingsPatch {
18         inherit src schemaIdToVariableMapping;
19       };
20     in
21     runCommandLocal
22       "makeHardcodeGsettingsPatch-tests-${name}"
24       {
25         nativeBuildInputs = [
26           git
27           clang-tools
28         ];
29       }
31       ''
32         cp -r --no-preserve=all "${src}" src
33         cp -r --no-preserve=all "${expected}" src-expected
35         pushd src
36         patch < "${patch}"
37         popd
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       '';
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   };