mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
tests/riff: add
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
b695586f92
commit
7522ba8a0c
4 changed files with 69 additions and 0 deletions
5
tests/modules/programs/riff/default.nix
Normal file
5
tests/modules/programs/riff/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
riff-basic = ./riff-basic.nix;
|
||||||
|
riff-with-git-integration = ./riff-with-git-integration.nix;
|
||||||
|
riff-migration = ./riff-migration.nix;
|
||||||
|
}
|
||||||
13
tests/modules/programs/riff/riff-basic.nix
Normal file
13
tests/modules/programs/riff/riff-basic.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
programs.riff = {
|
||||||
|
enable = true;
|
||||||
|
commandLineOptions = [ "--no-adds-only-special" ];
|
||||||
|
};
|
||||||
|
programs.git.enable = true;
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
# Git config should NOT contain riff configuration since enableGitIntegration is false by default
|
||||||
|
assertFileNotRegex home-files/.config/git/config '\[pager\]'
|
||||||
|
assertFileNotRegex home-files/.config/git/config 'diff = riff'
|
||||||
|
'';
|
||||||
|
}
|
||||||
32
tests/modules/programs/riff/riff-migration.nix
Normal file
32
tests/modules/programs/riff/riff-migration.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
options,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.git = {
|
||||||
|
enable = true;
|
||||||
|
riff = {
|
||||||
|
enable = true;
|
||||||
|
commandLineOptions = [ "--no-adds-only-special" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
test.asserts.warnings.expected = [
|
||||||
|
"The option `programs.git.riff.commandLineOptions' defined in ${lib.showFiles options.programs.git.riff.commandLineOptions.files} has been renamed to `programs.riff.commandLineOptions'."
|
||||||
|
"The option `programs.git.riff.enable' defined in ${lib.showFiles options.programs.git.riff.enable.files} has been renamed to `programs.riff.enable'."
|
||||||
|
"`programs.riff.enableGitIntegration` automatic enablement is deprecated. Please explicitly set `programs.riff.enableGitIntegration = true`."
|
||||||
|
];
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
# Git config should contain riff configuration (backward compatibility)
|
||||||
|
assertFileExists home-files/.config/git/config
|
||||||
|
assertFileContains home-files/.config/git/config '[pager]'
|
||||||
|
assertFileContains home-files/.config/git/config 'diff = "riff"'
|
||||||
|
assertFileContains home-files/.config/git/config 'log = "riff"'
|
||||||
|
assertFileContains home-files/.config/git/config 'show = "riff"'
|
||||||
|
assertFileContains home-files/.config/git/config '[interactive]'
|
||||||
|
assertFileContains home-files/.config/git/config 'diffFilter = "riff --color=on"'
|
||||||
|
'';
|
||||||
|
}
|
||||||
19
tests/modules/programs/riff/riff-with-git-integration.nix
Normal file
19
tests/modules/programs/riff/riff-with-git-integration.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
programs.riff = {
|
||||||
|
enable = true;
|
||||||
|
enableGitIntegration = true;
|
||||||
|
commandLineOptions = [ "--no-adds-only-special" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.git.enable = true;
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.config/git/config
|
||||||
|
assertFileContains home-files/.config/git/config '[pager]'
|
||||||
|
assertFileContains home-files/.config/git/config 'diff = "riff"'
|
||||||
|
assertFileContains home-files/.config/git/config 'log = "riff"'
|
||||||
|
assertFileContains home-files/.config/git/config 'show = "riff"'
|
||||||
|
assertFileContains home-files/.config/git/config '[interactive]'
|
||||||
|
assertFileContains home-files/.config/git/config 'diffFilter = "riff --color=on"'
|
||||||
|
'';
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue