about summary refs log tree commit diff
path: root/lib/tests/modules
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2020-09-30 01:47:10 +0200
committerSilvan Mosberger <contact@infinisil.com>2021-05-03 22:16:06 +0200
commit8b957e3b301d748e6fbbed806d82bd9d4b9d4ac4 (patch)
treebad03f138c7df9f2970b3c3d87fd37ce0b875919 /lib/tests/modules
parent4b54aedee5e05aaf2838f6d951508b83e33d2baa (diff)
lib/tests: Add type deprecation tests
Diffstat (limited to 'lib/tests/modules')
-rw-r--r--lib/tests/modules/type-deprecation.nix39
1 files changed, 39 insertions, 0 deletions
diff --git a/lib/tests/modules/type-deprecation.nix b/lib/tests/modules/type-deprecation.nix
new file mode 100644
index 0000000000000..2d7a1fc9aca59
--- /dev/null
+++ b/lib/tests/modules/type-deprecation.nix
@@ -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 "";
+  };
+
+}