mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
lib/tests: add more tests for mkPackageOption
This commit is contained in:
parent
19241f5618
commit
d27d38c13a
2 changed files with 32 additions and 0 deletions
|
@ -227,8 +227,14 @@ checkConfigOutput '^false$' config.enableAlias ./alias-with-priority-can-overrid
|
||||||
|
|
||||||
# Check mkPackageOption
|
# Check mkPackageOption
|
||||||
checkConfigOutput '^"hello"$' config.package.pname ./declare-mkPackageOption.nix
|
checkConfigOutput '^"hello"$' config.package.pname ./declare-mkPackageOption.nix
|
||||||
|
checkConfigOutput '^"hello"$' config.namedPackage.pname ./declare-mkPackageOption.nix
|
||||||
|
checkConfigOutput '^".*Hello.*"$' options.namedPackage.description ./declare-mkPackageOption.nix
|
||||||
|
checkConfigOutput '^"hello"$' config.pathPackage.pname ./declare-mkPackageOption.nix
|
||||||
|
checkConfigOutput '^"pkgs\.hello\.override \{ stdenv = pkgs\.clangStdenv; \}"$' options.packageWithExample.example.text ./declare-mkPackageOption.nix
|
||||||
|
checkConfigOutput '^".*Example extra description\..*"$' options.packageWithExtraDescription.description ./declare-mkPackageOption.nix
|
||||||
checkConfigError 'The option .undefinedPackage. is used but not defined' config.undefinedPackage ./declare-mkPackageOption.nix
|
checkConfigError 'The option .undefinedPackage. is used but not defined' config.undefinedPackage ./declare-mkPackageOption.nix
|
||||||
checkConfigOutput '^null$' config.nullablePackage ./declare-mkPackageOption.nix
|
checkConfigOutput '^null$' config.nullablePackage ./declare-mkPackageOption.nix
|
||||||
|
checkConfigOutput '^"null or package"$' options.nullablePackageWithDefault.type.description ./declare-mkPackageOption.nix
|
||||||
|
|
||||||
# submoduleWith
|
# submoduleWith
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,28 @@ in {
|
||||||
options = {
|
options = {
|
||||||
package = lib.mkPackageOption pkgs "hello" { };
|
package = lib.mkPackageOption pkgs "hello" { };
|
||||||
|
|
||||||
|
namedPackage = lib.mkPackageOption pkgs "Hello" {
|
||||||
|
default = [ "hello" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
namedPackageSingletonDefault = lib.mkPackageOption pkgs "Hello" {
|
||||||
|
default = "hello";
|
||||||
|
};
|
||||||
|
|
||||||
|
pathPackage = lib.mkPackageOption pkgs [ "hello" ] { };
|
||||||
|
|
||||||
|
packageWithExample = lib.mkPackageOption pkgs "hello" {
|
||||||
|
example = "pkgs.hello.override { stdenv = pkgs.clangStdenv; }";
|
||||||
|
};
|
||||||
|
|
||||||
|
packageWithPathExample = lib.mkPackageOption pkgs "hello" {
|
||||||
|
example = [ "hello" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
packageWithExtraDescription = lib.mkPackageOption pkgs "hello" {
|
||||||
|
extraDescription = "Example extra description.";
|
||||||
|
};
|
||||||
|
|
||||||
undefinedPackage = lib.mkPackageOption pkgs "hello" {
|
undefinedPackage = lib.mkPackageOption pkgs "hello" {
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
|
@ -15,5 +37,9 @@ in {
|
||||||
nullable = true;
|
nullable = true;
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nullablePackageWithDefault = lib.mkPackageOption pkgs "hello" {
|
||||||
|
nullable = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue