lib/tests: Add type deprecation tests
This commit is contained in:
parent
4b54aedee5
commit
8b957e3b30
|
@ -272,6 +272,12 @@ checkConfigError 'A definition for option .fun.\[function body\]. is not of type
|
||||||
checkConfigOutput "b a" config.result ./functionTo/list-order.nix
|
checkConfigOutput "b a" config.result ./functionTo/list-order.nix
|
||||||
checkConfigOutput "a c" config.result ./functionTo/merging-attrs.nix
|
checkConfigOutput "a c" config.result ./functionTo/merging-attrs.nix
|
||||||
|
|
||||||
|
## Type deprecation
|
||||||
|
checkConfigError 'The type `types.simple'\'' of option `simple'\'' defined in .* is deprecated. simple shall not be used' config.simple ./type-deprecation.nix
|
||||||
|
checkConfigError 'The type `types.infinite'\'' of option `infinite'\'' defined in .* is deprecated. infinite shall not be used' config.infinite ./type-deprecation.nix
|
||||||
|
checkConfigError 'The type `types.left'\'' of option `nested'\'' defined in .* is deprecated. left shall not be used' config.nested ./type-deprecation.nix
|
||||||
|
checkConfigError 'The type `types.right'\'' of option `nested'\'' defined in .* is deprecated. right shall not be used' config.nested ./type-deprecation.nix
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
====== module tests ======
|
====== module tests ======
|
||||||
$pass Pass
|
$pass Pass
|
||||||
|
|
39
lib/tests/modules/type-deprecation.nix
Normal file
39
lib/tests/modules/type-deprecation.nix
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
{ lib, ... }: {
|
||||||
|
|
||||||
|
options.simple = lib.mkOption {
|
||||||
|
type = lib.mkOptionType {
|
||||||
|
name = "simple";
|
||||||
|
deprecationMessage = "simple shall not be used";
|
||||||
|
};
|
||||||
|
default = throw "";
|
||||||
|
};
|
||||||
|
|
||||||
|
options.infinite = lib.mkOption {
|
||||||
|
type =
|
||||||
|
let
|
||||||
|
t = lib.mkOptionType {
|
||||||
|
name = "infinite";
|
||||||
|
deprecationMessage = "infinite shall not be used";
|
||||||
|
};
|
||||||
|
r = lib.types.either t (lib.types.attrsOf r);
|
||||||
|
in r;
|
||||||
|
default = throw "";
|
||||||
|
};
|
||||||
|
|
||||||
|
options.nested = lib.mkOption {
|
||||||
|
type =
|
||||||
|
let
|
||||||
|
left = lib.mkOptionType {
|
||||||
|
name = "left";
|
||||||
|
deprecationMessage = "left shall not be used";
|
||||||
|
};
|
||||||
|
right = lib.mkOptionType {
|
||||||
|
name = "right";
|
||||||
|
deprecationMessage = "right shall not be used";
|
||||||
|
};
|
||||||
|
in lib.types.either left right;
|
||||||
|
|
||||||
|
default = throw "";
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue