mirror of
https://github.com/nix-community/home-manager
synced 2024-11-30 06:59:45 +01:00
bottom: fix empty-settings test on darwin (#2603)
The empty configuration test for the bottom module introduced as of https://github.com/nix-community/home-manager/pull/2323 is not cross platform. Specifically, it silently fails under a darwin environment due to the configuration file not being generated at $XDG_CONFIG_HOME. This PR add cross platform support by specifying the platform-dependent configuration directories to check. The expected unit test data was also extracted to a separate file to differentiate between test data changes and changes to the test itself.
This commit is contained in:
parent
c2f151258a
commit
7c0dc519e1
3 changed files with 14 additions and 12 deletions
|
@ -9,8 +9,13 @@ with lib;
|
||||||
package = config.lib.test.mkStubPackage { };
|
package = config.lib.test.mkStubPackage { };
|
||||||
};
|
};
|
||||||
|
|
||||||
nmt.script = ''
|
nmt.script = let
|
||||||
assertPathNotExists home-files/.config/bottom
|
configDir = if pkgs.stdenv.isDarwin then
|
||||||
|
"home-files/Library/Application Support"
|
||||||
|
else
|
||||||
|
"home-files/.config";
|
||||||
|
in ''
|
||||||
|
assertPathNotExists ${configDir}/bottom
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
[colors]
|
||||||
|
low_battery_color = "red"
|
||||||
|
|
||||||
|
[flags]
|
||||||
|
avg_cpu = true
|
||||||
|
temperature_type = "c"
|
|
@ -26,16 +26,7 @@ with lib;
|
||||||
in ''
|
in ''
|
||||||
assertFileContent \
|
assertFileContent \
|
||||||
"${configDir}/bottom/bottom.toml" \
|
"${configDir}/bottom/bottom.toml" \
|
||||||
${
|
${./example-settings-expected.toml}
|
||||||
builtins.toFile "example-settings-expected.toml" ''
|
|
||||||
[colors]
|
|
||||||
low_battery_color = "red"
|
|
||||||
|
|
||||||
[flags]
|
|
||||||
avg_cpu = true
|
|
||||||
temperature_type = "c"
|
|
||||||
''
|
|
||||||
}
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue