summaryrefslogtreecommitdiffstats
path: root/lib/tests
diff options
context:
space:
mode:
authorGabriel Gonzalez <Gabriel439@gmail.com>2019-12-11 16:30:05 -0800
committerGabriel Gonzalez <Gabriel439@gmail.com>2019-12-11 16:30:05 -0800
commit183a99734f666b6bd508f4c81e887dbc746fec69 (patch)
tree5ac296649a3555d5f27a1155cf546d110e11ff6c /lib/tests
parent98e57f8999cc88e3d4b2250adef51747ade5105e (diff)
Add `pkgs.lib.renderOptions`
This adds a new utility to intelligently convert Nix records to command line options to reduce boilerplate for simple use cases and to also reduce the likelihood of malformed command lines
Diffstat (limited to 'lib/tests')
-rw-r--r--lib/tests/misc.nix16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix
index b064faa1e1ba..a5f191410e54 100644
--- a/lib/tests/misc.nix
+++ b/lib/tests/misc.nix
@@ -441,4 +441,20 @@ runTests {
expected = "«foo»";
};
+ testRenderOptions = {
+ expr =
+ renderOptions
+ { foo = "A";
+
+ bar = 1;
+
+ baz = null;
+
+ qux = true;
+
+ v = true;
+ };
+
+ expected = " --bar '1' --foo 'A' --qux -v";
+ };
}