Commit 17c056fa authored by Robert Hensing's avatar Robert Hensing
Browse files

lib.types.optionDeclaration: test error

parent 7334dd90
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -706,6 +706,7 @@ checkConfigError 'The option .group..*would be a parent of the following options

# types.optionDeclaration
checkConfigOutput '^10$' config.anOption ./option.nix
checkConfigError 'A definition for option .aBadOptionDef. is not of type .option declaration.' config.aBadOptionDef ./option.nix

# Test that types.optionType merges types correctly
checkConfigOutput '^10$' config.theOption.int ./optionTypeMerging.nix
+13 −1
Original line number Diff line number Diff line
{ config, lib, ... }:
{
  config,
  lib,
  options,
  ...
}:
{
  options = {
    theOption = lib.mkOption {
      type = lib.types.optionDeclaration;
    };
    anOption = config.theOption;
    aBadOptionDef = lib.mkOption {
      type = lib.types.optionDeclaration;
      description = ''
        This option is perfectly fine, but will have a bad definition.
      '';
    };
  };
  config = {
    theOption = lib.mkOption {
      type = lib.types.int;
    };
    anOption = 10;
    aBadOptionDef = options.theOption; # Not a declaration
  };
}