formats.ini: Introduce listToValue argument (#121613)

Allows coercing lists to values. E.g.

  formats.ini { listToValue = lib.concatMapStringsSep ", " (lib.generators.mkValueStringDefault {}); }
This commit is contained in:
Silvan Mosberger
2021-05-04 09:49:25 +02:00
committed by GitHub
parent 3cc34f9e55
commit b8336c2b8a
3 changed files with 51 additions and 3 deletions

View File

@@ -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;