summary refs log tree commit diff
path: root/lib/tests.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2016-12-04 22:11:24 +0100
committerGitHub <noreply@github.com>2016-12-04 22:11:24 +0100
commitea412cd5a1b3ca93d86f7a43dcdecb5784155dae (patch)
tree82fdd805e6681835ca638db97c07642b27b37aad /lib/tests.nix
parent2f861e6ba652eb580babd179a632a1413caae061 (diff)
downloadnixpkgs-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.nix16
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 = "";