about summary refs log tree commit diff
path: root/lib/tests
diff options
context:
space:
mode:
authorRob Pilling <robpilling@gmail.com>2024-05-06 12:41:46 +0100
committerRob Pilling <robpilling@gmail.com>2024-05-22 07:58:26 +0100
commit9c9c3848d41dae2ae83f92dfdc5599917e509b99 (patch)
tree4710550495804aab2500dd135dece2c054eb7baa /lib/tests
parent4ed7156191b6b4d0b9df398a29af50a1b93073f0 (diff)
cli.nix: permit separators between args -> `-a=b`, `--xyz=abc`, etc
Diffstat (limited to 'lib/tests')
-rw-r--r--lib/tests/misc.nix21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix
index 6774939023d20..408ea54162938 100644
--- a/lib/tests/misc.nix
+++ b/lib/tests/misc.nix
@@ -1639,6 +1639,27 @@ runTests {
     ];
   };
 
+  testToGNUCommandLineSeparator = {
+    expr = cli.toGNUCommandLine { optionValueSeparator = "="; } {
+      data = builtins.toJSON { id = 0; };
+      X = "PUT";
+      retry = 3;
+      retry-delay = null;
+      url = [ "https://example.com/foo" "https://example.com/bar" ];
+      silent = false;
+      verbose = true;
+    };
+
+    expected = [
+      "-X=PUT"
+      "--data={\"id\":0}"
+      "--retry=3"
+      "--url=https://example.com/foo"
+      "--url=https://example.com/bar"
+      "--verbose"
+    ];
+  };
+
   testToGNUCommandLineShell = {
     expr = cli.toGNUCommandLineShell {} {
       data = builtins.toJSON { id = 0; };