summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorVwCSXg <VwCSXg@proton.me>2023-08-21 13:12:40 +0200
committerVwCSXg <VwCSXg@proton.me>2023-08-21 13:12:40 +0200
commit147560180c5b39266d10c6a6b8f54110d9667b99 (patch)
tree92febe1926003b7df7ad42e62591bb623c260764 /lib
parenta88b90c9dbb0db665ed62bb47296f4f3524cd267 (diff)
downloadnixpkgs-147560180c5b39266d10c6a6b8f54110d9667b99.tar
nixpkgs-147560180c5b39266d10c6a6b8f54110d9667b99.tar.gz
nixpkgs-147560180c5b39266d10c6a6b8f54110d9667b99.tar.bz2
nixpkgs-147560180c5b39266d10c6a6b8f54110d9667b99.tar.lz
nixpkgs-147560180c5b39266d10c6a6b8f54110d9667b99.tar.xz
nixpkgs-147560180c5b39266d10c6a6b8f54110d9667b99.tar.zst
nixpkgs-147560180c5b39266d10c6a6b8f54110d9667b99.zip
lib.generators.toGitINI: added test
Added basic generators.toGitINI test.
Mostly taken from https://github.com/nix-community/home-manager/blob/958c06303f43cf0625694326b7f7e5475b1a2d5c/tests/modules/programs/git/git.nix.
The ${"\t} escape is used so that the lines aren't recognized as "Wrong
indent style".
Diffstat (limited to 'lib')
-rw-r--r--lib/tests/misc.nix45
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix
index 6d55ae68477..80223dccb26 100644
--- a/lib/tests/misc.nix
+++ b/lib/tests/misc.nix
@@ -948,6 +948,51 @@ runTests {
     '';
   };
 
+  testToGitINI = {
+    expr = generators.toGitINI {
+      user = {
+        email = "user@example.org";
+        name = "John Doe";
+        signingKey = "00112233445566778899AABBCCDDEEFF";
+      };
+      gpg.program = "path-to-gpg";
+      tag.gpgSign = true;
+      include.path = "~/path/to/config.inc";
+      includeIf."gitdif:~/src/dir".path = "~/path/to/conditional.inc";
+      extra = {
+        boolean = true;
+        integer = 38;
+        name = "value";
+        subsection.value = "test";
+      };};
+    expected = ''
+      [extra]
+      ${"\t"}boolean = true
+      ${"\t"}integer = 38
+      ${"\t"}name = "value"
+
+      [extra "subsection"]
+      ${"\t"}value = "test"
+
+      [gpg]
+      ${"\t"}program = "path-to-gpg"
+
+      [include]
+      ${"\t"}path = "~/path/to/config.inc"
+
+      [includeIf "gitdif:~/src/dir"]
+      ${"\t"}path = "~/path/to/conditional.inc"
+
+      [tag]
+      ${"\t"}gpgSign = true
+
+      [user]
+      ${"\t"}email = "user@example.org"
+      ${"\t"}name = "John Doe"
+      ${"\t"}signingKey = "00112233445566778899AABBCCDDEEFF"
+    '';
+  };
+
   /* right now only invocation check */
   testToJSONSimple =
     let val = {