mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-25 12:22:37 +03:00
lib/tests: add mkPackageOption tests
This commit is contained in:
parent
4a56b2655e
commit
ac9915b1ea
@ -182,6 +182,11 @@ checkConfigOutput '^true$' config.enableAlias ./alias-with-priority.nix
|
||||
checkConfigOutput '^false$' config.enable ./alias-with-priority-can-override.nix
|
||||
checkConfigOutput '^false$' config.enableAlias ./alias-with-priority-can-override.nix
|
||||
|
||||
# Check mkPackageOption
|
||||
checkConfigOutput '^"hello"$' config.package.pname ./declare-mkPackageOption.nix
|
||||
checkConfigError 'The option .undefinedPackage. is used but not defined' config.undefinedPackage ./declare-mkPackageOption.nix
|
||||
checkConfigOutput '^null$' config.nullablePackage ./declare-mkPackageOption.nix
|
||||
|
||||
# submoduleWith
|
||||
|
||||
## specialArgs should work
|
||||
|
19
lib/tests/modules/declare-mkPackageOption.nix
Normal file
19
lib/tests/modules/declare-mkPackageOption.nix
Normal file
@ -0,0 +1,19 @@
|
||||
{ lib, ... }: let
|
||||
pkgs.hello = {
|
||||
type = "derivation";
|
||||
pname = "hello";
|
||||
};
|
||||
in {
|
||||
options = {
|
||||
package = lib.mkPackageOption pkgs "hello" { };
|
||||
|
||||
undefinedPackage = lib.mkPackageOption pkgs "hello" {
|
||||
default = null;
|
||||
};
|
||||
|
||||
nullablePackage = lib.mkPackageOption pkgs "hello" {
|
||||
nullable = true;
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user