lib/tests: remove strictly loaOf tests and rebase on attrsOf
This commit is contained in:
@@ -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);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user