tests: add initial test framework
This commit is contained in:
parent
5d63abb473
commit
6d56abcec1
9 changed files with 146 additions and 1 deletions
23
tests/modules/programs/git-expected.conf
Normal file
23
tests/modules/programs/git-expected.conf
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
[alias]
|
||||
a1=foo
|
||||
a2=bar
|
||||
|
||||
[commit]
|
||||
gpgSign=true
|
||||
|
||||
[extra]
|
||||
name=value
|
||||
|
||||
[gpg]
|
||||
program=path-to-gpg
|
||||
|
||||
[user]
|
||||
email=user@example.org
|
||||
name=John Doe
|
||||
signingKey=00112233445566778899AABBCCDDEEFF
|
||||
|
||||
[include]
|
||||
path = ~/path/to/config.inc
|
||||
|
||||
[includeIf "gitdir:~/src/dir"]
|
||||
path = ~/path/to/conditional.inc
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
This can be anything.
|
||||
|
||||
[user]
|
||||
email=user@example.org
|
||||
name=John Doe
|
||||
22
tests/modules/programs/git-with-str-extra-config.nix
Normal file
22
tests/modules/programs/git-with-str-extra-config.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
This can be anything.
|
||||
'';
|
||||
userEmail = "user@example.org";
|
||||
userName = "John Doe";
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/git/config
|
||||
assertFileContent home-files/.config/git/config \
|
||||
${./git-with-str-extra-config-expected.conf}
|
||||
'';
|
||||
};
|
||||
}
|
||||
40
tests/modules/programs/git.nix
Normal file
40
tests/modules/programs/git.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
aliases = {
|
||||
a1 = "foo";
|
||||
a2 = "bar";
|
||||
};
|
||||
extraConfig = {
|
||||
extra = {
|
||||
name = "value";
|
||||
};
|
||||
};
|
||||
ignores = [ "*~" "*.swp" ];
|
||||
includes = [
|
||||
{ path = "~/path/to/config.inc"; }
|
||||
{
|
||||
path = "~/path/to/conditional.inc";
|
||||
condition = "gitdir:~/src/dir";
|
||||
}
|
||||
];
|
||||
signing = {
|
||||
gpgPath = "path-to-gpg";
|
||||
key = "00112233445566778899AABBCCDDEEFF";
|
||||
signByDefault = true;
|
||||
};
|
||||
userEmail = "user@example.org";
|
||||
userName = "John Doe";
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/git/config
|
||||
assertFileContent home-files/.config/git/config ${./git-expected.conf}
|
||||
'';
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue