summary refs log tree commit diff
path: root/lib/tests
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2017-10-31 17:30:15 +0100
committerProfpatsch <mail@profpatsch.de>2017-11-05 15:56:32 +0100
commit462c048c77fa0aa0cb4c47d7812a57f094587f68 (patch)
tree608f72f36e786fee42167fc4d58df8888cedb5ff /lib/tests
parent1158910676323b57ba0248a71ad0a0d8e57a960b (diff)
downloadnixpkgs-462c048c77fa0aa0cb4c47d7812a57f094587f68.tar
nixpkgs-462c048c77fa0aa0cb4c47d7812a57f094587f68.tar.gz
nixpkgs-462c048c77fa0aa0cb4c47d7812a57f094587f68.tar.bz2
nixpkgs-462c048c77fa0aa0cb4c47d7812a57f094587f68.tar.lz
nixpkgs-462c048c77fa0aa0cb4c47d7812a57f094587f68.tar.xz
nixpkgs-462c048c77fa0aa0cb4c47d7812a57f094587f68.tar.zst
nixpkgs-462c048c77fa0aa0cb4c47d7812a57f094587f68.zip
lib/types: add `ints.positive`.
For values that are positive, but cannot be 0.
Diffstat (limited to 'lib/tests')
-rwxr-xr-xlib/tests/modules.sh2
-rw-r--r--lib/tests/modules/declare-int-positive-value.nix9
-rw-r--r--lib/tests/modules/define-value-int-zero.nix3
3 files changed, 14 insertions, 0 deletions
diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh
index ac0372e66f8..96a91c0fffb 100755
--- a/lib/tests/modules.sh
+++ b/lib/tests/modules.sh
@@ -65,6 +65,8 @@ checkConfigError 'The option .* defined in .* does not exist.' config.enable ./d
 # unsigned
 checkConfigOutput "42" config.value ./declare-int-unsigned-value.nix ./define-value-int-positive.nix
 checkConfigError 'The option value .* in .* is not of type.*unsigned integer.*' config.value ./declare-int-unsigned-value.nix ./define-value-int-negative.nix
+# positive
+checkConfigError 'The option value .* in .* is not of type.*positive integer.*' config.value ./declare-int-positive-value.nix ./define-value-int-zero.nix
 # between
 checkConfigOutput "42" config.value ./declare-int-between-value.nix ./define-value-int-positive.nix
 checkConfigError 'The option value .* in .* is not of type.*between.*-21 and 43.*inclusive.*' config.value ./declare-int-between-value.nix ./define-value-int-negative.nix
diff --git a/lib/tests/modules/declare-int-positive-value.nix b/lib/tests/modules/declare-int-positive-value.nix
new file mode 100644
index 00000000000..6e48c6ac8fe
--- /dev/null
+++ b/lib/tests/modules/declare-int-positive-value.nix
@@ -0,0 +1,9 @@
+{ lib, ... }:
+
+{
+  options = {
+    value = lib.mkOption {
+      type = lib.types.ints.positive;
+    };
+  };
+}
diff --git a/lib/tests/modules/define-value-int-zero.nix b/lib/tests/modules/define-value-int-zero.nix
new file mode 100644
index 00000000000..68bb9f415c3
--- /dev/null
+++ b/lib/tests/modules/define-value-int-zero.nix
@@ -0,0 +1,3 @@
+{
+  value = 0;
+}