mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
tests/man: add tests for man-db/mandoc
This commit is contained in:
committed by
Austin Horstman
parent
f02e422b3e
commit
7914f8d7d7
15
tests/modules/programs/man/assertion.nix
Normal file
15
tests/modules/programs/man/assertion.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
config = {
|
||||
test.asserts.assertions.expected = [
|
||||
''
|
||||
man-db and mandoc can't be used as the man page viewer at the same time!
|
||||
''
|
||||
];
|
||||
|
||||
programs.man = {
|
||||
enable = true;
|
||||
man-db.enable = true;
|
||||
mandoc.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
{
|
||||
man-apropos = ./apropos.nix;
|
||||
man-assertion = ./assertion.nix;
|
||||
man-disabled-man-db = ./disabled-man-db.nix;
|
||||
man-disabled-mandoc = ./disabled-mandoc.nix;
|
||||
man-extra-config = ./extra-config.nix;
|
||||
man-mandoc = ./mandoc.nix;
|
||||
man-no-manpath = ./no-manpath.nix;
|
||||
man-no-caches-without-package = ./no-caches-without-package.nix;
|
||||
}
|
||||
|
||||
14
tests/modules/programs/man/disabled-man-db.nix
Normal file
14
tests/modules/programs/man/disabled-man-db.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
config = {
|
||||
programs.man = {
|
||||
enable = false;
|
||||
man-db.enable = true;
|
||||
mandoc.enable = false;
|
||||
generateCaches = true;
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.manpath
|
||||
'';
|
||||
};
|
||||
}
|
||||
31
tests/modules/programs/man/disabled-mandoc.nix
Normal file
31
tests/modules/programs/man/disabled-mandoc.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
config = {
|
||||
programs.man = {
|
||||
enable = false;
|
||||
man-db.enable = false;
|
||||
mandoc.enable = true;
|
||||
generateCaches = true;
|
||||
};
|
||||
|
||||
test.stubs = {
|
||||
mandoc = {
|
||||
outPath = null;
|
||||
buildScript = ''
|
||||
mkdir -p $out/bin
|
||||
touch $out/bin/{man,makewhatis}
|
||||
chmod +x $out/bin/*
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
hmSessVars=home-path/etc/profile.d/hm-session-vars.sh
|
||||
|
||||
assertPathNotExists home-files/.manpath
|
||||
assertPathNotExists home-files/.local/share/mandoc/man
|
||||
|
||||
assertFileExists "$hmSessVars"
|
||||
assertFileNotRegex "$hmSessVars" 'MANPATH='
|
||||
'';
|
||||
};
|
||||
}
|
||||
24
tests/modules/programs/man/extra-config.nix
Normal file
24
tests/modules/programs/man/extra-config.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
{ lib, options, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
test.asserts.warnings.expected = [
|
||||
"The option `programs.man.extraConfig' defined in ${lib.showFiles options.programs.man.extraConfig.files} has been renamed to `programs.man.man-db.extraConfig'."
|
||||
];
|
||||
|
||||
programs.man = {
|
||||
enable = true;
|
||||
generateCaches = true;
|
||||
extraConfig = ''
|
||||
MANDATORY_MANPATH /usr/man
|
||||
SECTION 1 n l 8
|
||||
'';
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.manpath
|
||||
assertFileContains home-files/.manpath 'MANDATORY_MANPATH /usr/man'
|
||||
assertFileContains home-files/.manpath 'SECTION 1 n l 8'
|
||||
'';
|
||||
};
|
||||
}
|
||||
31
tests/modules/programs/man/mandoc.nix
Normal file
31
tests/modules/programs/man/mandoc.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
config = {
|
||||
programs.man = {
|
||||
enable = true;
|
||||
man-db.enable = false;
|
||||
mandoc.enable = true;
|
||||
generateCaches = true;
|
||||
};
|
||||
|
||||
test.stubs = {
|
||||
mandoc = {
|
||||
outPath = null;
|
||||
buildScript = ''
|
||||
mkdir -p $out/bin
|
||||
touch $out/bin/{man,makewhatis}
|
||||
chmod +x $out/bin/*
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
hmSessVars=home-path/etc/profile.d/hm-session-vars.sh
|
||||
|
||||
assertLinkExists home-files/.local/share/mandoc/man
|
||||
|
||||
assertFileExists $hmSessVars
|
||||
assertFileContains $hmSessVars \
|
||||
'export MANPATH="/home/hm-user/.local/share/mandoc/man''${MANPATH:+:}$MANPATH"'
|
||||
'';
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user