lib/tests: remove strictly loaOf tests and rebase on attrsOf

rnhmjoj cde46494 1d61efb7

+25 -31
lib/tests/modules.sh
···
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
···
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
···
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
+2 -2
lib/tests/modules/declare-loaOfSub-any-enable.nix lib/tests/modules/declare-attrsOfSub-any-enable.nix
···
{
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
···
+
{
+
attrsOfSub.bar.enable = true;
+
}
+3
lib/tests/modules/define-attrsOfSub-bar.nix
···
+
{
+
attrsOfSub.bar = {};
+
}
+5
lib/tests/modules/define-attrsOfSub-foo-enable-force.nix
···
+
{ lib, ... }:
+
+
{
+
attrsOfSub.foo.enable = lib.mkForce false;
+
}
+5
lib/tests/modules/define-attrsOfSub-foo-enable-if.nix
···
+
{ config, lib, ... }:
+
+
{
+
attrsOfSub.foo.enable = lib.mkIf config.enable true;
+
}
+3
lib/tests/modules/define-attrsOfSub-foo-enable.nix
···
+
{
+
attrsOfSub.foo.enable = true;
+
}
+7
lib/tests/modules/define-attrsOfSub-foo-force-enable.nix
···
+
{ lib, ... }:
+
+
{
+
attrsOfSub.foo = lib.mkForce {
+
enable = false;
+
};
+
}
+7
lib/tests/modules/define-attrsOfSub-foo-if-enable.nix
···
+
{ config, lib, ... }:
+
+
{
+
attrsOfSub.foo = lib.mkIf config.enable {
+
enable = true;
+
};
+
}
+3
lib/tests/modules/define-attrsOfSub-foo.nix
···
+
{
+
attrsOfSub.foo = {};
+
}
+7
lib/tests/modules/define-attrsOfSub-if-foo-enable.nix
···
+
{ config, lib, ... }:
+
+
{
+
attrsOfSub = lib.mkIf config.enable {
+
foo.enable = true;
+
};
+
}
+5
lib/tests/modules/define-force-attrsOfSub-foo-enable.nix
···
+
{ lib, ... }:
+
+
lib.mkForce {
+
attrsOfSub.foo.enable = false;
+
}
-5
lib/tests/modules/define-force-loaOfSub-foo-enable.nix
···
-
{ lib, ... }:
-
-
lib.mkForce {
-
loaOfSub.foo.enable = false;
-
}
+1 -1
lib/tests/modules/define-if-loaOfSub-foo-enable.nix lib/tests/modules/define-if-attrsOfSub-foo-enable.nix
···
{ config, lib, ... }:
lib.mkIf config.enable {
-
loaOfSub.foo.enable = true;
+
attrsOfSub.foo.enable = true;
}
-3
lib/tests/modules/define-loaOfSub-bar-enable.nix
···
-
{
-
loaOfSub.bar.enable = true;
-
}
-3
lib/tests/modules/define-loaOfSub-bar.nix
···
-
{
-
loaOfSub.bar = {};
-
}
-5
lib/tests/modules/define-loaOfSub-foo-enable-force.nix
···
-
{ lib, ... }:
-
-
{
-
loaOfSub.foo.enable = lib.mkForce false;
-
}
-5
lib/tests/modules/define-loaOfSub-foo-enable-if.nix
···
-
{ config, lib, ... }:
-
-
{
-
loaOfSub.foo.enable = lib.mkIf config.enable true;
-
}
-3
lib/tests/modules/define-loaOfSub-foo-enable.nix
···
-
{
-
loaOfSub.foo.enable = true;
-
}
-7
lib/tests/modules/define-loaOfSub-foo-force-enable.nix
···
-
{ lib, ... }:
-
-
{
-
loaOfSub.foo = lib.mkForce {
-
enable = false;
-
};
-
}
-7
lib/tests/modules/define-loaOfSub-foo-if-enable.nix
···
-
{ config, lib, ... }:
-
-
{
-
loaOfSub.foo = lib.mkIf config.enable {
-
enable = true;
-
};
-
}
-3
lib/tests/modules/define-loaOfSub-foo.nix
···
-
{
-
loaOfSub.foo = {};
-
}
+1 -1
lib/tests/modules/define-loaOfSub-force-foo-enable.nix lib/tests/modules/define-attrsOfSub-force-foo-enable.nix
···
{ lib, ... }:
{
-
loaOfSub = lib.mkForce {
+
attrsOfSub = lib.mkForce {
foo.enable = false;
};
}
-7
lib/tests/modules/define-loaOfSub-if-foo-enable.nix
···
-
{ config, lib, ... }:
-
-
{
-
loaOfSub = lib.mkIf config.enable {
-
foo.enable = true;
-
};
-
}
-19
lib/tests/modules/loaOf-with-long-list.nix
···
-
{ 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);
-
};
-
}
-19
lib/tests/modules/loaOf-with-many-list-merges.nix
···
-
{ 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);
-
};
-
}