about summary refs log tree commit diff
path: root/pkgs/pkgs-lib/tests
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2021-05-04 09:49:25 +0200
committerGitHub <noreply@github.com>2021-05-04 09:49:25 +0200
commitb8336c2b8abaabb4307ef2f1c38ec48f2f1dbf6f (patch)
treea930fd87aeef8f1719fcdd6722123c6f11b44393 /pkgs/pkgs-lib/tests
parent3cc34f9e559e3d6d06c7fdb29392e04beef805e1 (diff)
formats.ini: Introduce `listToValue` argument (#121613)
Allows coercing lists to values. E.g.

  formats.ini { listToValue = lib.concatMapStringsSep ", " (lib.generators.mkValueStringDefault {}); }
Diffstat (limited to 'pkgs/pkgs-lib/tests')
-rw-r--r--pkgs/pkgs-lib/tests/formats.nix16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkgs/pkgs-lib/tests/formats.nix b/pkgs/pkgs-lib/tests/formats.nix
index 16b760a5ada14..2c117e29e9ba9 100644
--- a/pkgs/pkgs-lib/tests/formats.nix
+++ b/pkgs/pkgs-lib/tests/formats.nix
@@ -124,6 +124,22 @@ in runBuildTests {
     '';
   };
 
+  testIniListToValue = {
+    drv = evalFormat formats.ini { listToValue = concatMapStringsSep ", " (generators.mkValueStringDefault {}); } {
+      foo = {
+        bar = [ null true "test" 1.2 10 ];
+        baz = false;
+        qux = "qux";
+      };
+    };
+    expected = ''
+      [foo]
+      bar=null, true, test, 1.200000, 10
+      baz=false
+      qux=qux
+    '';
+  };
+
   testTomlAtoms = {
     drv = evalFormat formats.toml {} {
       false = false;