mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 00:43:20 +00:00
lib/tests: add more tests for mkPackageOption
This commit is contained in:
parent
19241f5618
commit
d27d38c13a
@ -227,8 +227,14 @@ checkConfigOutput '^false$' config.enableAlias ./alias-with-priority-can-overrid
|
||||
|
||||
# Check mkPackageOption
|
||||
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
|
||||
checkConfigOutput '^null$' config.nullablePackage ./declare-mkPackageOption.nix
|
||||
checkConfigOutput '^"null or package"$' options.nullablePackageWithDefault.type.description ./declare-mkPackageOption.nix
|
||||
|
||||
# submoduleWith
|
||||
|
||||
|
@ -7,6 +7,28 @@ in {
|
||||
options = {
|
||||
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" {
|
||||
default = null;
|
||||
};
|
||||
@ -15,5 +37,9 @@ in {
|
||||
nullable = true;
|
||||
default = null;
|
||||
};
|
||||
|
||||
nullablePackageWithDefault = lib.mkPackageOption pkgs "hello" {
|
||||
nullable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user