diff options
author | Nicolas B. Pierron <nicolas.b.pierron@gmail.com> | 2015-02-08 21:48:38 +0100 |
---|---|---|
committer | Nicolas B. Pierron <nicolas.b.pierron@gmail.com> | 2015-02-09 00:07:44 +0100 |
commit | 6d15e32536abbcef919b706f073c7fea46cf9229 (patch) | |
tree | 6c184b1cb051ddd2b155da740312e93d0d1df733 /lib/tests/modules | |
parent | d54611bde7468dafa9145335ed56504df4e10445 (diff) |
Issue #6161 - Add tests for NixOS modules.
Diffstat (limited to 'lib/tests/modules')
-rw-r--r-- | lib/tests/modules/declare-enable.nix | 14 | ||||
-rw-r--r-- | lib/tests/modules/declare-loaOfSub-any-enable.nix | 29 | ||||
-rw-r--r-- | lib/tests/modules/default.nix | 7 | ||||
-rw-r--r-- | lib/tests/modules/define-enable-force.nix | 5 | ||||
-rw-r--r-- | lib/tests/modules/define-enable.nix | 3 | ||||
-rw-r--r-- | lib/tests/modules/define-force-enable.nix | 5 | ||||
-rw-r--r-- | lib/tests/modules/define-force-loaOfSub-foo-enable.nix | 5 | ||||
-rw-r--r-- | lib/tests/modules/define-loaOfSub-bar-enable.nix | 3 | ||||
-rw-r--r-- | lib/tests/modules/define-loaOfSub-bar.nix | 3 | ||||
-rw-r--r-- | lib/tests/modules/define-loaOfSub-foo-enable-force.nix | 5 | ||||
-rw-r--r-- | lib/tests/modules/define-loaOfSub-foo-enable.nix | 3 | ||||
-rw-r--r-- | lib/tests/modules/define-loaOfSub-foo-force-enable.nix | 7 | ||||
-rw-r--r-- | lib/tests/modules/define-loaOfSub-foo.nix | 3 | ||||
-rw-r--r-- | lib/tests/modules/define-loaOfSub-force-foo-enable.nix | 7 |
14 files changed, 99 insertions, 0 deletions
diff --git a/lib/tests/modules/declare-enable.nix b/lib/tests/modules/declare-enable.nix new file mode 100644 index 000000000000..ebee243c7568 --- /dev/null +++ b/lib/tests/modules/declare-enable.nix @@ -0,0 +1,14 @@ +{ lib, ... }: + +{ + options = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = '' + Some descriptive text + ''; + }; + }; +} diff --git a/lib/tests/modules/declare-loaOfSub-any-enable.nix b/lib/tests/modules/declare-loaOfSub-any-enable.nix new file mode 100644 index 000000000000..71dad1c91359 --- /dev/null +++ b/lib/tests/modules/declare-loaOfSub-any-enable.nix @@ -0,0 +1,29 @@ +{ lib, ... }: + +let + submod = { ... }: { + options = { + enable = lib.mkOption { + default = false; + example = true; + type = lib.types.bool; + description = '' + Some descriptive text + ''; + }; + }; + }; +in + +{ + options = { + loaOfSub = lib.mkOption { + default = {}; + example = {}; + type = lib.types.loaOf (lib.types.submodule [ submod ]); + description = '' + Some descriptive text + ''; + }; + }; +} diff --git a/lib/tests/modules/default.nix b/lib/tests/modules/default.nix new file mode 100644 index 000000000000..5df7d9751eab --- /dev/null +++ b/lib/tests/modules/default.nix @@ -0,0 +1,7 @@ +{ lib ? import <nixpkgs/lib>, modules ? [] }: + +{ + inherit (lib.evalModules { + inherit modules; + }) config options; +} diff --git a/lib/tests/modules/define-enable-force.nix b/lib/tests/modules/define-enable-force.nix new file mode 100644 index 000000000000..f4990a328631 --- /dev/null +++ b/lib/tests/modules/define-enable-force.nix @@ -0,0 +1,5 @@ +{ lib, ... }: + +{ + enable = lib.mkForce false; +} diff --git a/lib/tests/modules/define-enable.nix b/lib/tests/modules/define-enable.nix new file mode 100644 index 000000000000..7dc26010ae59 --- /dev/null +++ b/lib/tests/modules/define-enable.nix @@ -0,0 +1,3 @@ +{ + enable = true; +} diff --git a/lib/tests/modules/define-force-enable.nix b/lib/tests/modules/define-force-enable.nix new file mode 100644 index 000000000000..978caa2a8c07 --- /dev/null +++ b/lib/tests/modules/define-force-enable.nix @@ -0,0 +1,5 @@ +{ lib, ... }: + +lib.mkForce { + enable = false; +} diff --git a/lib/tests/modules/define-force-loaOfSub-foo-enable.nix b/lib/tests/modules/define-force-loaOfSub-foo-enable.nix new file mode 100644 index 000000000000..bfd8e084b590 --- /dev/null +++ b/lib/tests/modules/define-force-loaOfSub-foo-enable.nix @@ -0,0 +1,5 @@ +{ lib, ... }: + +lib.mkForce { + loaOfSub.foo.enable = false; +} diff --git a/lib/tests/modules/define-loaOfSub-bar-enable.nix b/lib/tests/modules/define-loaOfSub-bar-enable.nix new file mode 100644 index 000000000000..422bb0a600bf --- /dev/null +++ b/lib/tests/modules/define-loaOfSub-bar-enable.nix @@ -0,0 +1,3 @@ +{ + loaOfSub.bar.enable = true; +} diff --git a/lib/tests/modules/define-loaOfSub-bar.nix b/lib/tests/modules/define-loaOfSub-bar.nix new file mode 100644 index 000000000000..c24315e09b6e --- /dev/null +++ b/lib/tests/modules/define-loaOfSub-bar.nix @@ -0,0 +1,3 @@ +{ + loaOfSub.bar = {}; +} diff --git a/lib/tests/modules/define-loaOfSub-foo-enable-force.nix b/lib/tests/modules/define-loaOfSub-foo-enable-force.nix new file mode 100644 index 000000000000..c1d7b198be54 --- /dev/null +++ b/lib/tests/modules/define-loaOfSub-foo-enable-force.nix @@ -0,0 +1,5 @@ +{ lib, ... }: + +{ + loaOfSub.foo.enable = lib.mkForce false; +} diff --git a/lib/tests/modules/define-loaOfSub-foo-enable.nix b/lib/tests/modules/define-loaOfSub-foo-enable.nix new file mode 100644 index 000000000000..822425c71bb9 --- /dev/null +++ b/lib/tests/modules/define-loaOfSub-foo-enable.nix @@ -0,0 +1,3 @@ +{ + loaOfSub.foo.enable = true; +} diff --git a/lib/tests/modules/define-loaOfSub-foo-force-enable.nix b/lib/tests/modules/define-loaOfSub-foo-force-enable.nix new file mode 100644 index 000000000000..dce0ef547b31 --- /dev/null +++ b/lib/tests/modules/define-loaOfSub-foo-force-enable.nix @@ -0,0 +1,7 @@ +{ lib, ... }: + +{ + loaOfSub.foo = lib.mkForce { + enable = false; + }; +} diff --git a/lib/tests/modules/define-loaOfSub-foo.nix b/lib/tests/modules/define-loaOfSub-foo.nix new file mode 100644 index 000000000000..e9b2e631f2ec --- /dev/null +++ b/lib/tests/modules/define-loaOfSub-foo.nix @@ -0,0 +1,3 @@ +{ + loaOfSub.foo = {}; +} diff --git a/lib/tests/modules/define-loaOfSub-force-foo-enable.nix b/lib/tests/modules/define-loaOfSub-force-foo-enable.nix new file mode 100644 index 000000000000..df5722274ee5 --- /dev/null +++ b/lib/tests/modules/define-loaOfSub-force-foo-enable.nix @@ -0,0 +1,7 @@ +{ lib, ... }: + +{ + loaOfSub = lib.mkForce { + foo.enable = false; + }; +} |