From 147560180c5b39266d10c6a6b8f54110d9667b99 Mon Sep 17 00:00:00 2001 From: VwCSXg Date: Mon, 21 Aug 2023 13:12:40 +0200 Subject: 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". --- lib/tests/misc.nix | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'lib/tests') diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index 6d55ae684771e..80223dccb2618 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 = { -- cgit 1.4.1