treewide: stub tests (#6275)

* ranger: stub tests

* alacritty: stub tests

* broot: stub tests

* zsh: stub tests

* vim-vint: stub tests
This commit is contained in:
Thiago Kenji Okada 2025-01-08 15:24:04 +00:00 committed by GitHub
parent 456e599f91
commit fcc4259cdb
Failed to generate hash of commit
19 changed files with 68 additions and 59 deletions

View file

@ -142,7 +142,7 @@ in {
config = mkIf cfg.enable (mkMerge [
{
programs.ranger.finalPackage = cfg.package.overrideAttrs (oldAttrs: {
propagatedBuildInputs = oldAttrs.propagatedBuildInputs
propagatedBuildInputs = (oldAttrs.propagatedBuildInputs or [ ])
++ cfg.extraPackages;
});

View file

@ -2,5 +2,5 @@
alacritty-example-settings = ./example-settings.nix;
alacritty-empty-settings = ./empty-settings.nix;
alacritty-merging-settings = ./settings-merging.nix;
alacritty-toml-config = ./toml_config.nix;
alacritty-toml-config = ./toml-config.nix;
}

View file

@ -20,6 +20,8 @@
};
};
test.stubs = { alacritty = { }; };
nmt.script = ''
assertFileContent \
home-files/.config/alacritty/alacritty.toml \

View file

@ -28,6 +28,8 @@
};
};
test.stubs = { alacritty = { }; };
nmt.script = ''
assertFileContent \
home-files/.config/alacritty/alacritty.toml \

View file

@ -25,6 +25,8 @@
};
};
test.stubs = { alacritty = { }; };
nmt.script = ''
assertFileContent \
home-files/.config/alacritty/alacritty.toml \

View file

@ -6,6 +6,11 @@
settings.modal = true;
};
tests.stubs = {
broot = { };
hjson = { };
};
nmt.script = ''
assertFileExists home-files/.config/broot/conf.toml
assertFileContains home-files/.config/broot/conf.toml 'modal = true'

View file

@ -31,6 +31,8 @@
];
};
test.stubs = { ranger = { }; };
nmt.script = ''
assertFileExists home-files/.config/ranger/rc.conf
assertFileContent home-files/.config/ranger/rc.conf \

View file

@ -1,4 +1,4 @@
{ config, pkgs, lib, xdg, ... }:
{ ... }:
{
programs.vim-vint = {
@ -19,6 +19,8 @@
};
};
test.stubs = { vim-vint = { }; };
nmt.script = ''
assertFileContent home-files/.config/.vintrc.yaml ${
./basic-configuration.yaml

View file

@ -1,9 +1,8 @@
{ config, lib, pkgs, ... }:
with lib;
{ ... }:
{
imports = [
./zsh-stubs.nix
({ ... }: { config.programs.zsh.history.ignorePatterns = [ "echo *" ]; })
({ ... }: { config.programs.zsh.history.ignorePatterns = [ "rm *" ]; })
];
@ -11,8 +10,6 @@ with lib;
config = {
programs.zsh.enable = true;
test.stubs.zsh = { };
nmt.script = ''
assertFileContains home-files/.zshrc "HISTORY_IGNORE='(echo *|rm *)'"
'';

View file

@ -1,8 +1,8 @@
{ config, lib, pkgs, ... }:
with lib;
{ ... }:
{
imports = [ ./zsh-stubs.nix ];
config = {
home.stateVersion = "20.03";
programs.zsh = {
@ -10,8 +10,6 @@ with lib;
history.path = "$HOME/some/directory/zsh_history";
};
test.stubs.zsh = { };
nmt.script = ''
assertFileRegex home-files/.zshrc '^HISTFILE="$HOME/some/directory/zsh_history"$'
'';

View file

@ -1,14 +1,12 @@
{ config, lib, pkgs, ... }:
with lib;
{ ... }:
{
imports = [ ./zsh-stubs.nix ];
config = {
home.stateVersion = "20.03";
programs.zsh.enable = true;
test.stubs.zsh = { };
nmt.script = ''
assertFileRegex home-files/.zshrc '^HISTFILE="$HOME/.zsh_history"$'
'';

View file

@ -1,8 +1,8 @@
{ config, lib, pkgs, ... }:
with lib;
{ ... }:
{
imports = [ ./zsh-stubs.nix ];
config = {
home.stateVersion = "19.09";
programs.zsh = {
@ -10,8 +10,6 @@ with lib;
history.path = "some/directory/zsh_history";
};
test.stubs.zsh = { };
nmt.script = ''
assertFileRegex home-files/.zshrc '^HISTFILE="$HOME/some/directory/zsh_history"$'
'';

View file

@ -1,14 +1,12 @@
{ config, lib, pkgs, ... }:
with lib;
{ ... }:
{
imports = [ ./zsh-stubs.nix ];
config = {
home.stateVersion = "19.03";
programs.zsh.enable = true;
test.stubs.zsh = { };
nmt.script = ''
assertFileRegex home-files/.zshrc '^HISTFILE="$HOME/.zsh_history"$'
'';

View file

@ -1,8 +1,8 @@
{ config, lib, pkgs, ... }:
with lib;
{ ... }:
{
imports = [ ./zsh-stubs.nix ];
config = {
programs.zsh = {
enable = true;
@ -13,8 +13,6 @@ with lib;
};
};
test.stubs.zsh = { };
# Written with regex to ensure we don't end up missing newlines in the future
nmt.script = ''
assertFileRegex home-files/.zshrc "^bindkey \"\^\[\[B\" history-substring-search-down$"

View file

@ -1,20 +1,9 @@
{ config, lib, pkgs, ... }:
with lib;
{ ... }:
{
programs.zsh.prezto.enable = true;
imports = [ ./zsh-stubs.nix ];
test.stubs.zsh-prezto = {
outPath = null;
buildScript = ''
mkdir -p $out/share/zsh-prezto/runcoms
echo '# zprofile' > $out/share/zsh-prezto/runcoms/zprofile
echo '# zlogin' > $out/share/zsh-prezto/runcoms/zlogin
echo '# zlogout' > $out/share/zsh-prezto/runcoms/zlogout
echo '# zshenv' > $out/share/zsh-prezto/runcoms/zshenv
'';
};
programs.zsh.prezto.enable = true;
nmt.script = ''
assertFileExists home-files/.zpreztorc

View file

@ -1,8 +1,8 @@
{ config, lib, pkgs, ... }:
with lib;
{ config, ... }:
{
imports = [ ./zsh-stubs.nix ];
config = {
programs.zsh = {
enable = true;
@ -13,8 +13,6 @@ with lib;
};
};
test.stubs.zsh = { };
nmt.script = ''
assertFileExists home-files/.zshenv
assertFileRegex home-files/.zshenv 'export V1="v1"'

View file

@ -1,8 +1,8 @@
{ config, lib, pkgs, ... }:
with lib;
{ pkgs, ... }:
{
imports = [ ./zsh-stubs.nix ];
config = {
programs.zsh = {
enable = true;
@ -15,8 +15,6 @@ with lib;
};
};
test.stubs.zsh = { };
nmt.script = ''
assertFileContains home-files/.zshrc "source ${pkgs.hello}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
assertFileContains home-files/.zshrc "ZSH_HIGHLIGHT_HIGHLIGHTERS+=(brackets pattern cursor)"

View file

@ -1,13 +1,13 @@
{ ... }:
{
imports = [ ./zsh-stubs.nix ];
programs.zsh.zsh-abbr = {
enable = true;
abbreviations = { ga = "git add"; };
};
test.stubs.zsh-abbr = { };
nmt.script = ''
abbreviations=home-files/.config/zsh-abbr/user-abbreviations

View file

@ -0,0 +1,22 @@
{ ... }:
{
test.stubs = {
hello = { };
nix-zsh-completions = { };
zsh = { };
zsh-abbr = { };
zsh-history-substring-search = { };
zsh-prezto = {
outPath = null;
buildScript = ''
mkdir -p $out/share/zsh-prezto/runcoms
echo '# zprofile' > $out/share/zsh-prezto/runcoms/zprofile
echo '# zlogin' > $out/share/zsh-prezto/runcoms/zlogin
echo '# zlogout' > $out/share/zsh-prezto/runcoms/zlogout
echo '# zshenv' > $out/share/zsh-prezto/runcoms/zshenv
'';
};
zsh-syntax-highlighting = { };
};
}