diff options
author | Linus Heckemann <git@sphalerite.org> | 2021-09-29 11:03:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-29 11:03:31 +0200 |
commit | a3df3d05e5db17b26ff886f53a58761a547561cc (patch) | |
tree | 3048af8fedf275f86fe60185936381823faffdd8 /lib/tests | |
parent | 40f34902e623ad3c130bbdb2a65c53610e933307 (diff) | |
parent | 681758d41588c27aaa6f3c3a72184dcc4d0aeba8 (diff) |
Merge pull request #131205 from Ma27/showdefs-overflow
lib/modules: improve errors for `options`/`config`-mixups
Diffstat (limited to 'lib/tests')
-rw-r--r-- | lib/tests/misc.nix | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index 4b2e5afc1d609..00eeaa2a77d79 100644 --- a/lib/tests/misc.nix +++ b/lib/tests/misc.nix @@ -529,6 +529,25 @@ runTests { }; }; + testToPrettyLimit = + let + a.b = 1; + a.c = a; + in { + expr = generators.toPretty { } (generators.withRecursion { throwOnDepthLimit = false; depthLimit = 2; } a); + expected = "{\n b = 1;\n c = {\n b = \"<unevaluated>\";\n c = {\n b = \"<unevaluated>\";\n c = \"<unevaluated>\";\n };\n };\n}"; + }; + + testToPrettyLimitThrow = + let + a.b = 1; + a.c = a; + in { + expr = (builtins.tryEval + (generators.toPretty { } (generators.withRecursion { depthLimit = 2; } a))).success; + expected = false; + }; + testToPrettyMultiline = { expr = mapAttrs (const (generators.toPretty { })) rec { list = [ 3 4 [ false ] ]; |