diff options
author | Silvan Mosberger <contact@infinisil.com> | 2022-04-06 19:02:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-06 19:02:36 +0200 |
commit | 180173a1c461eab9c04d50080374dcbbffcef712 (patch) | |
tree | d791e7eecebb90c0777f781c2a50653a792f8391 /lib/tests | |
parent | 2c95971556400c470211f475802e4a04804a79a0 (diff) | |
parent | 626ecc7bd72668e8624bfc3eac3635a1a31d1bf3 (diff) |
Merge pull request #164088 from Profpatsch/lib.generators-add-toINIWithGlobalSection
lib.generators: add toINIWithGlobalSection
Diffstat (limited to 'lib/tests')
-rw-r--r-- | lib/tests/misc.nix | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index 9012bba2b5675..fcccf89cc888c 100644 --- a/lib/tests/misc.nix +++ b/lib/tests/misc.nix @@ -471,6 +471,66 @@ runTests { ''; }; + testToINIWithGlobalSectionEmpty = { + expr = generators.toINIWithGlobalSection {} { + globalSection = { + }; + sections = { + }; + }; + expected = '' + ''; + }; + + testToINIWithGlobalSectionGlobalEmptyIsTheSameAsToINI = + let + sections = { + "section 1" = { + attribute1 = 5; + x = "Me-se JarJar Binx"; + }; + "foo" = { + "he\\h=he" = "this is okay"; + }; + }; + in { + expr = + generators.toINIWithGlobalSection {} { + globalSection = {}; + sections = sections; + }; + expected = generators.toINI {} sections; + }; + + testToINIWithGlobalSectionFull = { + expr = generators.toINIWithGlobalSection {} { + globalSection = { + foo = "bar"; + test = false; + }; + sections = { + "section 1" = { + attribute1 = 5; + x = "Me-se JarJar Binx"; + }; + "foo" = { + "he\\h=he" = "this is okay"; + }; + }; + }; + expected = '' + foo=bar + test=false + + [foo] + he\h\=he=this is okay + + [section 1] + attribute1=5 + x=Me-se JarJar Binx + ''; + }; + /* right now only invocation check */ testToJSONSimple = let val = { |