lib/generators: add toKeyValue & mkKeyValueLine (#20903)
generators for the common use case of simple config files which hold keys and values. Used in the implementation for toINI.
This commit is contained in:
@@ -135,6 +135,22 @@ runTests {
|
||||
# these tests assume attributes are converted to lists
|
||||
# in alphabetical order
|
||||
|
||||
testMkKeyValueLine = {
|
||||
expr = generators.mkKeyValueLine ":" "f:oo" "bar";
|
||||
expected = ''f\:oo:bar'';
|
||||
};
|
||||
|
||||
testToKeyValue = {
|
||||
expr = generators.toKeyValue {} {
|
||||
key = "value";
|
||||
"other=key" = "baz";
|
||||
};
|
||||
expected = ''
|
||||
key=value
|
||||
other\=key=baz
|
||||
'';
|
||||
};
|
||||
|
||||
testToINIEmpty = {
|
||||
expr = generators.toINI {} {};
|
||||
expected = "";
|
||||
|
||||
Reference in New Issue
Block a user