From 7529a2674a34309bec6117df3a6c0b4906b2c313 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Tue, 7 Feb 2023 22:19:10 +0100 Subject: [PATCH] scmpuff: clean up tests Stub the scmpuff package. Also remove unnecessary `config` wrapping. --- tests/modules/programs/scmpuff/bash.nix | 26 ++++++++------- tests/modules/programs/scmpuff/fish.nix | 4 ++- tests/modules/programs/scmpuff/no-bash.nix | 26 ++++++++------- tests/modules/programs/scmpuff/no-fish.nix | 4 ++- tests/modules/programs/scmpuff/no-shell.nix | 37 +++++++++++---------- tests/modules/programs/scmpuff/no-zsh.nix | 31 +++++++++-------- tests/modules/programs/scmpuff/zsh.nix | 31 +++++++++-------- 7 files changed, 88 insertions(+), 71 deletions(-) diff --git a/tests/modules/programs/scmpuff/bash.nix b/tests/modules/programs/scmpuff/bash.nix index ea34373b9..942d472f9 100644 --- a/tests/modules/programs/scmpuff/bash.nix +++ b/tests/modules/programs/scmpuff/bash.nix @@ -1,15 +1,17 @@ -{ pkgs, ... }: { - config = { - programs = { - scmpuff.enable = true; - bash.enable = true; - }; +{ ... }: - nmt.script = '' - assertFileExists home-files/.bashrc - assertFileContains \ - home-files/.bashrc \ - 'eval "$(${pkgs.scmpuff}/bin/scmpuff init -s)"' - ''; +{ + programs = { + scmpuff.enable = true; + bash.enable = true; }; + + test.stubs.scmpuff = { }; + + nmt.script = '' + assertFileExists home-files/.bashrc + assertFileContains \ + home-files/.bashrc \ + 'eval "$(@scmpuff@/bin/scmpuff init -s)"' + ''; } diff --git a/tests/modules/programs/scmpuff/fish.nix b/tests/modules/programs/scmpuff/fish.nix index 5326995f5..920196b16 100644 --- a/tests/modules/programs/scmpuff/fish.nix +++ b/tests/modules/programs/scmpuff/fish.nix @@ -1,4 +1,6 @@ -{ pkgs, lib, ... }: { +{ lib, ... }: + +{ programs = { scmpuff.enable = true; fish.enable = true; diff --git a/tests/modules/programs/scmpuff/no-bash.nix b/tests/modules/programs/scmpuff/no-bash.nix index e3852b84a..e76295a53 100644 --- a/tests/modules/programs/scmpuff/no-bash.nix +++ b/tests/modules/programs/scmpuff/no-bash.nix @@ -1,15 +1,17 @@ -{ pkgs, ... }: { - config = { - programs = { - scmpuff = { - enable = true; - enableBashIntegration = false; - }; - bash.enable = true; - }; +{ ... }: - nmt.script = '' - assertFileNotRegex home-files/.bashrc '${pkgs.scmpuff}/bin/scmpuff' - ''; +{ + programs = { + scmpuff = { + enable = true; + enableBashIntegration = false; + }; + bash.enable = true; }; + + test.stubs.scmpuff = { }; + + nmt.script = '' + assertFileNotRegex home-files/.bashrc '@scmpuff@/bin/scmpuff' + ''; } diff --git a/tests/modules/programs/scmpuff/no-fish.nix b/tests/modules/programs/scmpuff/no-fish.nix index 94666a598..977b8fd3a 100644 --- a/tests/modules/programs/scmpuff/no-fish.nix +++ b/tests/modules/programs/scmpuff/no-fish.nix @@ -1,4 +1,6 @@ -{ pkgs, lib, ... }: { +{ lib, ... }: + +{ programs = { scmpuff = { enable = true; diff --git a/tests/modules/programs/scmpuff/no-shell.nix b/tests/modules/programs/scmpuff/no-shell.nix index ddc40773e..1f479efda 100644 --- a/tests/modules/programs/scmpuff/no-shell.nix +++ b/tests/modules/programs/scmpuff/no-shell.nix @@ -1,20 +1,23 @@ -{ pkgs, ... }: { - config = { - programs = { - scmpuff = { - enable = true; - enableBashIntegration = false; - enableZshIntegration = false; - }; - bash.enable = true; - zsh.enable = true; +{ ... }: + +{ + programs = { + scmpuff = { + enable = true; + enableBashIntegration = false; + enableZshIntegration = false; }; - - test.stubs.zsh = { }; - - nmt.script = '' - assertFileNotRegex home-files/.zshrc '${pkgs.scmpuff} init -s' - assertFileNotRegex home-files/.bashrc '${pkgs.scmpuff} init -s' - ''; + bash.enable = true; + zsh.enable = true; }; + + test.stubs = { + zsh = { }; + scmpuff = { }; + }; + + nmt.script = '' + assertFileNotRegex home-files/.zshrc '@scmpuff@ init -s' + assertFileNotRegex home-files/.bashrc '@scmpuff@ init -s' + ''; } diff --git a/tests/modules/programs/scmpuff/no-zsh.nix b/tests/modules/programs/scmpuff/no-zsh.nix index 5854fdd6f..d6ed24490 100644 --- a/tests/modules/programs/scmpuff/no-zsh.nix +++ b/tests/modules/programs/scmpuff/no-zsh.nix @@ -1,17 +1,20 @@ -{ pkgs, ... }: { - config = { - programs = { - scmpuff = { - enable = true; - enableZshIntegration = false; - }; - zsh.enable = true; +{ ... }: + +{ + programs = { + scmpuff = { + enable = true; + enableZshIntegration = false; }; - - test.stubs.zsh = { }; - - nmt.script = '' - assertFileNotRegex home-files/.zshrc '${pkgs.scmpuff} init -s' - ''; + zsh.enable = true; }; + + test.stubs = { + zsh = { }; + scmpuff = { }; + }; + + nmt.script = '' + assertFileNotRegex home-files/.zshrc '@scmpuff@ init -s' + ''; } diff --git a/tests/modules/programs/scmpuff/zsh.nix b/tests/modules/programs/scmpuff/zsh.nix index d132945f6..ce0a0eaeb 100644 --- a/tests/modules/programs/scmpuff/zsh.nix +++ b/tests/modules/programs/scmpuff/zsh.nix @@ -1,17 +1,20 @@ -{ pkgs, ... }: { - config = { - programs = { - scmpuff.enable = true; - zsh.enable = true; - }; +{ ... }: - test.stubs.zsh = { }; - - nmt.script = '' - assertFileExists home-files/.zshrc - assertFileContains \ - home-files/.zshrc \ - 'eval "$(${pkgs.scmpuff}/bin/scmpuff init -s)"' - ''; +{ + programs = { + scmpuff.enable = true; + zsh.enable = true; }; + + test.stubs = { + zsh = { }; + scmpuff = { }; + }; + + nmt.script = '' + assertFileExists home-files/.zshrc + assertFileContains \ + home-files/.zshrc \ + 'eval "$(@scmpuff@/bin/scmpuff init -s)"' + ''; }