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