diff options
Diffstat (limited to 'home-manager/tests/modules/programs/git/git-with-email.nix')
-rw-r--r-- | home-manager/tests/modules/programs/git/git-with-email.nix | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/home-manager/tests/modules/programs/git/git-with-email.nix b/home-manager/tests/modules/programs/git/git-with-email.nix new file mode 100644 index 00000000000..ca577eef4d3 --- /dev/null +++ b/home-manager/tests/modules/programs/git/git-with-email.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + imports = [ ../../accounts/email-test-accounts.nix ]; + + config = { + programs.git = { + enable = true; + package = pkgs.gitMinimal; + userEmail = "hm@example.com"; + userName = "H. M. Test"; + }; + + nmt.script = '' + function assertGitConfig() { + local value + value=$(${pkgs.git}/bin/git config \ + --file $TESTED/home-files/.config/git/config \ + --get $1) + if [[ $value != $2 ]]; then + fail "Expected option '$1' to have value '$2' but it was '$value'" + fi + } + + assertFileExists home-files/.config/git/config + assertFileContent home-files/.config/git/config ${ + ./git-with-email-expected.conf + } + + assertGitConfig "sendemail.hm@example.com.from" "hm@example.com" + assertGitConfig "sendemail.hm-account.from" "hm@example.org" + ''; + }; +} |