lib/generators.toPretty: Only quote attribute names if necessary

wip/yesman
Silvan Mosberger 4 years ago
parent f3bf0f173e
commit 0f6231702f
No known key found for this signature in database
GPG Key ID: E8F1E9EAD284E17D
  1. 2
      lib/generators.nix
  2. 2
      lib/tests/misc.nix

@ -227,7 +227,7 @@ rec {
else "{ "
+ libStr.concatStringsSep " " (libAttr.mapAttrsToList
(name: value:
"${toPretty args name} = ${toPretty args value};") v)
"${libStr.escapeNixIdentifier name} = ${toPretty args value};") v)
+ " }"
else if isFunction v then
let fna = lib.functionArgs v;

@ -469,7 +469,7 @@ runTests {
function = "<λ>";
functionArgs = "<λ:{(arg),foo}>";
list = "[ 3 4 ${function} [ false ] ]";
attrs = "{ \"foo\" = null; \"foo bar\" = \"baz\"; }";
attrs = "{ foo = null; \"foo bar\" = \"baz\"; }";
drv = "<δ:test>";
};
};

Loading…
Cancel
Save