mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
tests/patdiff: add
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
c80be80282
commit
41fd9b197c
4 changed files with 56 additions and 0 deletions
5
tests/modules/programs/patdiff/default.nix
Normal file
5
tests/modules/programs/patdiff/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
patdiff-basic = ./patdiff-basic.nix;
|
||||||
|
patdiff-with-git-integration = ./patdiff-with-git-integration.nix;
|
||||||
|
patdiff-migration = ./patdiff-migration.nix;
|
||||||
|
}
|
||||||
11
tests/modules/programs/patdiff/patdiff-basic.nix
Normal file
11
tests/modules/programs/patdiff/patdiff-basic.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
programs.patdiff = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
programs.git.enable = true;
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
# Git config should NOT contain patdiff configuration since enableGitIntegration is false by default
|
||||||
|
assertFileNotRegex home-files/.config/git/config 'external = .*/patdiff-git-wrapper'
|
||||||
|
'';
|
||||||
|
}
|
||||||
26
tests/modules/programs/patdiff/patdiff-migration.nix
Normal file
26
tests/modules/programs/patdiff/patdiff-migration.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
options,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.git = {
|
||||||
|
enable = true;
|
||||||
|
patdiff = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
test.asserts.warnings.expected = [
|
||||||
|
"The option `programs.git.patdiff.enable' defined in ${lib.showFiles options.programs.git.patdiff.enable.files} has been renamed to `programs.patdiff.enable'."
|
||||||
|
"`programs.patdiff.enableGitIntegration` automatic enablement is deprecated. Please explicitly set `programs.patdiff.enableGitIntegration = true`."
|
||||||
|
];
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
# Git config should contain patdiff configuration (backward compatibility)
|
||||||
|
assertFileExists home-files/.config/git/config
|
||||||
|
assertFileContains home-files/.config/git/config '[diff]'
|
||||||
|
assertFileRegex home-files/.config/git/config 'external = .*/patdiff-git-wrapper'
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
programs.patdiff = {
|
||||||
|
enable = true;
|
||||||
|
enableGitIntegration = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.git.enable = true;
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.config/git/config
|
||||||
|
assertFileContains home-files/.config/git/config '[diff]'
|
||||||
|
assertFileRegex home-files/.config/git/config 'external = .*/patdiff-git-wrapper'
|
||||||
|
'';
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue