tests: mpv: refactor stubs definition
I am about to introduce more tests making use of the stubs, let's centralize them in one file.
This commit is contained in:
parent
c3f348111f
commit
ccd5351436
2 changed files with 42 additions and 12 deletions
|
|
@ -4,24 +4,14 @@
|
|||
}:
|
||||
|
||||
{
|
||||
imports = [ ./stubs.nix ];
|
||||
|
||||
programs.mpv = {
|
||||
enable = true;
|
||||
package = pkgs.emptyDirectory;
|
||||
scripts = [ pkgs.mpvScript ];
|
||||
};
|
||||
|
||||
test.stubs = {
|
||||
mpv = {
|
||||
extraAttrs.override = { ... }: pkgs.emptyDirectory;
|
||||
};
|
||||
|
||||
mpvScript = {
|
||||
extraAttrs = {
|
||||
scriptName = "something";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
test.asserts.assertions.expected = [
|
||||
''The programs.mpv "package" option is mutually exclusive with "scripts" option.''
|
||||
];
|
||||
|
|
|
|||
40
tests/modules/programs/mpv/stubs.nix
Normal file
40
tests/modules/programs/mpv/stubs.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{ lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
test.stubs = {
|
||||
mpv-unwrapped = {
|
||||
name = "mpv-unwrapped";
|
||||
outPath = null;
|
||||
buildScript = ''
|
||||
mkdir -p $out/bin $out/share/applications
|
||||
echo "Name=mpv" > $out/share/applications/mpv.desktop
|
||||
|
||||
cp ${pkgs.writeShellScript "mpv" "exit 0"} $out/bin/mpv
|
||||
chmod +x $out/bin/mpv
|
||||
'';
|
||||
|
||||
extraAttrs = {
|
||||
meta =
|
||||
let
|
||||
stub = "stub";
|
||||
in
|
||||
{
|
||||
description = stub;
|
||||
longDescription = stub;
|
||||
homepage = stub;
|
||||
mainProgram = stub;
|
||||
license = [ stub ];
|
||||
maintainers = [ stub ];
|
||||
teams = [ stub ];
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
mpvScript = {
|
||||
extraAttrs = {
|
||||
scriptName = "mpvScript";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue