diff options
author | Profpatsch <mail@profpatsch.de> | 2016-12-04 22:11:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-04 22:11:24 +0100 |
commit | ea412cd5a1b3ca93d86f7a43dcdecb5784155dae (patch) | |
tree | 82fdd805e6681835ca638db97c07642b27b37aad /lib/tests.nix | |
parent | 2f861e6ba652eb580babd179a632a1413caae061 (diff) | |
download | nixpkgs-ea412cd5a1b3ca93d86f7a43dcdecb5784155dae.tar nixpkgs-ea412cd5a1b3ca93d86f7a43dcdecb5784155dae.tar.gz nixpkgs-ea412cd5a1b3ca93d86f7a43dcdecb5784155dae.tar.bz2 nixpkgs-ea412cd5a1b3ca93d86f7a43dcdecb5784155dae.tar.lz nixpkgs-ea412cd5a1b3ca93d86f7a43dcdecb5784155dae.tar.xz nixpkgs-ea412cd5a1b3ca93d86f7a43dcdecb5784155dae.tar.zst nixpkgs-ea412cd5a1b3ca93d86f7a43dcdecb5784155dae.zip |
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.
Diffstat (limited to 'lib/tests.nix')
-rw-r--r-- | lib/tests.nix | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/tests.nix b/lib/tests.nix index d59814987ed..afbaf11a7f7 100644 --- a/lib/tests.nix +++ b/lib/tests.nix @@ -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 = ""; |