lib/tests: remove strictly loaOf tests and rebase on attrsOf
This commit is contained in:
parent
1d61efb7f1
commit
cde46494c6
@ -87,36 +87,36 @@ checkConfigOutput "false" "$@" ./define-force-enable.nix
|
||||
checkConfigOutput "false" "$@" ./define-enable-force.nix
|
||||
|
||||
# Check mkForce with option and submodules.
|
||||
checkConfigError 'attribute .*foo.* .* not found' config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix
|
||||
checkConfigOutput 'false' config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix
|
||||
set -- config.loaOfSub.foo.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo-enable.nix
|
||||
checkConfigError 'attribute .*foo.* .* not found' config.attrsOfSub.foo.enable ./declare-attrsOfSub-any-enable.nix
|
||||
checkConfigOutput 'false' config.attrsOfSub.foo.enable ./declare-attrsOfSub-any-enable.nix ./define-attrsOfSub-foo.nix
|
||||
set -- config.attrsOfSub.foo.enable ./declare-attrsOfSub-any-enable.nix ./define-attrsOfSub-foo-enable.nix
|
||||
checkConfigOutput 'true' "$@"
|
||||
checkConfigOutput 'false' "$@" ./define-force-loaOfSub-foo-enable.nix
|
||||
checkConfigOutput 'false' "$@" ./define-loaOfSub-force-foo-enable.nix
|
||||
checkConfigOutput 'false' "$@" ./define-loaOfSub-foo-force-enable.nix
|
||||
checkConfigOutput 'false' "$@" ./define-loaOfSub-foo-enable-force.nix
|
||||
checkConfigOutput 'false' "$@" ./define-force-attrsOfSub-foo-enable.nix
|
||||
checkConfigOutput 'false' "$@" ./define-attrsOfSub-force-foo-enable.nix
|
||||
checkConfigOutput 'false' "$@" ./define-attrsOfSub-foo-force-enable.nix
|
||||
checkConfigOutput 'false' "$@" ./define-attrsOfSub-foo-enable-force.nix
|
||||
|
||||
# Check overriding effect of mkForce on submodule definitions.
|
||||
checkConfigError 'attribute .*bar.* .* not found' config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix
|
||||
checkConfigOutput 'false' config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix ./define-loaOfSub-bar.nix
|
||||
set -- config.loaOfSub.bar.enable ./declare-loaOfSub-any-enable.nix ./define-loaOfSub-foo.nix ./define-loaOfSub-bar-enable.nix
|
||||
checkConfigError 'attribute .*bar.* .* not found' config.attrsOfSub.bar.enable ./declare-attrsOfSub-any-enable.nix ./define-attrsOfSub-foo.nix
|
||||
checkConfigOutput 'false' config.attrsOfSub.bar.enable ./declare-attrsOfSub-any-enable.nix ./define-attrsOfSub-foo.nix ./define-attrsOfSub-bar.nix
|
||||
set -- config.attrsOfSub.bar.enable ./declare-attrsOfSub-any-enable.nix ./define-attrsOfSub-foo.nix ./define-attrsOfSub-bar-enable.nix
|
||||
checkConfigOutput 'true' "$@"
|
||||
checkConfigError 'attribute .*bar.* .* not found' "$@" ./define-force-loaOfSub-foo-enable.nix
|
||||
checkConfigError 'attribute .*bar.* .* not found' "$@" ./define-loaOfSub-force-foo-enable.nix
|
||||
checkConfigOutput 'true' "$@" ./define-loaOfSub-foo-force-enable.nix
|
||||
checkConfigOutput 'true' "$@" ./define-loaOfSub-foo-enable-force.nix
|
||||
checkConfigError 'attribute .*bar.* .* not found' "$@" ./define-force-attrsOfSub-foo-enable.nix
|
||||
checkConfigError 'attribute .*bar.* .* not found' "$@" ./define-attrsOfSub-force-foo-enable.nix
|
||||
checkConfigOutput 'true' "$@" ./define-attrsOfSub-foo-force-enable.nix
|
||||
checkConfigOutput 'true' "$@" ./define-attrsOfSub-foo-enable-force.nix
|
||||
|
||||
# Check mkIf with submodules.
|
||||
checkConfigError 'attribute .*foo.* .* not found' config.loaOfSub.foo.enable ./declare-enable.nix ./declare-loaOfSub-any-enable.nix
|
||||
set -- config.loaOfSub.foo.enable ./declare-enable.nix ./declare-loaOfSub-any-enable.nix
|
||||
checkConfigError 'attribute .*foo.* .* not found' "$@" ./define-if-loaOfSub-foo-enable.nix
|
||||
checkConfigError 'attribute .*foo.* .* not found' "$@" ./define-loaOfSub-if-foo-enable.nix
|
||||
checkConfigError 'attribute .*foo.* .* not found' "$@" ./define-loaOfSub-foo-if-enable.nix
|
||||
checkConfigOutput 'false' "$@" ./define-loaOfSub-foo-enable-if.nix
|
||||
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-if-loaOfSub-foo-enable.nix
|
||||
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-loaOfSub-if-foo-enable.nix
|
||||
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-loaOfSub-foo-if-enable.nix
|
||||
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-loaOfSub-foo-enable-if.nix
|
||||
checkConfigError 'attribute .*foo.* .* not found' config.attrsOfSub.foo.enable ./declare-enable.nix ./declare-attrsOfSub-any-enable.nix
|
||||
set -- config.attrsOfSub.foo.enable ./declare-enable.nix ./declare-attrsOfSub-any-enable.nix
|
||||
checkConfigError 'attribute .*foo.* .* not found' "$@" ./define-if-attrsOfSub-foo-enable.nix
|
||||
checkConfigError 'attribute .*foo.* .* not found' "$@" ./define-attrsOfSub-if-foo-enable.nix
|
||||
checkConfigError 'attribute .*foo.* .* not found' "$@" ./define-attrsOfSub-foo-if-enable.nix
|
||||
checkConfigOutput 'false' "$@" ./define-attrsOfSub-foo-enable-if.nix
|
||||
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-if-attrsOfSub-foo-enable.nix
|
||||
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-attrsOfSub-if-foo-enable.nix
|
||||
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-attrsOfSub-foo-if-enable.nix
|
||||
checkConfigOutput 'true' "$@" ./define-enable.nix ./define-attrsOfSub-foo-enable-if.nix
|
||||
|
||||
# Check disabledModules with config definitions and option declarations.
|
||||
set -- config.enable ./define-enable.nix ./declare-enable.nix
|
||||
@ -138,7 +138,7 @@ checkConfigError 'while evaluating the module argument .*custom.* in .*import-cu
|
||||
checkConfigError 'infinite recursion encountered' "$@"
|
||||
|
||||
# Check _module.check.
|
||||
set -- config.enable ./declare-enable.nix ./define-enable.nix ./define-loaOfSub-foo.nix
|
||||
set -- config.enable ./declare-enable.nix ./define-enable.nix ./define-attrsOfSub-foo.nix
|
||||
checkConfigError 'The option .* defined in .* does not exist.' "$@"
|
||||
checkConfigOutput "true" "$@" ./define-module-check.nix
|
||||
|
||||
@ -152,12 +152,6 @@ checkConfigOutput "12" config.value ./declare-coerced-value-unsound.nix
|
||||
checkConfigError 'The option value .* in .* is not.*8 bit signed integer.* or string convertible to it' config.value ./declare-coerced-value-unsound.nix ./define-value-string-bigint.nix
|
||||
checkConfigError 'unrecognised JSON value' config.value ./declare-coerced-value-unsound.nix ./define-value-string-arbitrary.nix
|
||||
|
||||
# Check loaOf with long list.
|
||||
checkConfigOutput "1 2 3 4 5 6 7 8 9 10" config.result ./loaOf-with-long-list.nix
|
||||
|
||||
# Check loaOf with many merges of lists.
|
||||
checkConfigOutput "1 2 3 4 5 6 7 8 9 10" config.result ./loaOf-with-many-list-merges.nix
|
||||
|
||||
# Check mkAliasOptionModule.
|
||||
checkConfigOutput "true" config.enable ./alias-with-priority.nix
|
||||
checkConfigOutput "true" config.enableAlias ./alias-with-priority.nix
|
||||
|
@ -17,10 +17,10 @@ in
|
||||
|
||||
{
|
||||
options = {
|
||||
loaOfSub = lib.mkOption {
|
||||
attrsOfSub = lib.mkOption {
|
||||
default = {};
|
||||
example = {};
|
||||
type = lib.types.loaOf (lib.types.submodule [ submod ]);
|
||||
type = lib.types.attrsOf (lib.types.submodule [ submod ]);
|
||||
description = ''
|
||||
Some descriptive text
|
||||
'';
|
3
lib/tests/modules/define-attrsOfSub-bar-enable.nix
Normal file
3
lib/tests/modules/define-attrsOfSub-bar-enable.nix
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
attrsOfSub.bar.enable = true;
|
||||
}
|
3
lib/tests/modules/define-attrsOfSub-bar.nix
Normal file
3
lib/tests/modules/define-attrsOfSub-bar.nix
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
attrsOfSub.bar = {};
|
||||
}
|
5
lib/tests/modules/define-attrsOfSub-foo-enable-force.nix
Normal file
5
lib/tests/modules/define-attrsOfSub-foo-enable-force.nix
Normal file
@ -0,0 +1,5 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
attrsOfSub.foo.enable = lib.mkForce false;
|
||||
}
|
5
lib/tests/modules/define-attrsOfSub-foo-enable-if.nix
Normal file
5
lib/tests/modules/define-attrsOfSub-foo-enable-if.nix
Normal file
@ -0,0 +1,5 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
attrsOfSub.foo.enable = lib.mkIf config.enable true;
|
||||
}
|
3
lib/tests/modules/define-attrsOfSub-foo-enable.nix
Normal file
3
lib/tests/modules/define-attrsOfSub-foo-enable.nix
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
attrsOfSub.foo.enable = true;
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
loaOfSub.foo = lib.mkForce {
|
||||
attrsOfSub.foo = lib.mkForce {
|
||||
enable = false;
|
||||
};
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
loaOfSub.foo = lib.mkIf config.enable {
|
||||
attrsOfSub.foo = lib.mkIf config.enable {
|
||||
enable = true;
|
||||
};
|
||||
}
|
3
lib/tests/modules/define-attrsOfSub-foo.nix
Normal file
3
lib/tests/modules/define-attrsOfSub-foo.nix
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
attrsOfSub.foo = {};
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
loaOfSub = lib.mkForce {
|
||||
attrsOfSub = lib.mkForce {
|
||||
foo.enable = false;
|
||||
};
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
loaOfSub = lib.mkIf config.enable {
|
||||
attrsOfSub = lib.mkIf config.enable {
|
||||
foo.enable = true;
|
||||
};
|
||||
}
|
5
lib/tests/modules/define-force-attrsOfSub-foo-enable.nix
Normal file
5
lib/tests/modules/define-force-attrsOfSub-foo-enable.nix
Normal file
@ -0,0 +1,5 @@
|
||||
{ lib, ... }:
|
||||
|
||||
lib.mkForce {
|
||||
attrsOfSub.foo.enable = false;
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
{ lib, ... }:
|
||||
|
||||
lib.mkForce {
|
||||
loaOfSub.foo.enable = false;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
lib.mkIf config.enable {
|
||||
loaOfSub.foo.enable = true;
|
||||
attrsOfSub.foo.enable = true;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
loaOfSub.bar.enable = true;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
loaOfSub.bar = {};
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
loaOfSub.foo.enable = lib.mkForce false;
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
loaOfSub.foo.enable = lib.mkIf config.enable true;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
loaOfSub.foo.enable = true;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
loaOfSub.foo = {};
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
options = {
|
||||
loaOfInt = lib.mkOption {
|
||||
type = lib.types.loaOf lib.types.int;
|
||||
};
|
||||
|
||||
result = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
loaOfInt = [ 1 2 3 4 5 6 7 8 9 10 ];
|
||||
|
||||
result = toString (lib.attrValues config.loaOfInt);
|
||||
};
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
options = {
|
||||
loaOfInt = lib.mkOption {
|
||||
type = lib.types.loaOf lib.types.int;
|
||||
};
|
||||
|
||||
result = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
loaOfInt = lib.mkMerge (map lib.singleton [ 1 2 3 4 5 6 7 8 9 10 ]);
|
||||
|
||||
result = toString (lib.attrValues config.loaOfInt);
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user