fix: pretty print expected aswell when format is "pretty"

This commit is contained in:
technofab 2025-05-11 02:05:01 +02:00
parent 4aaaf32621
commit 9068477650
2 changed files with 13 additions and 1 deletions

View file

@ -99,6 +99,13 @@
}; };
}; };
} }
{
name = "pretty-unit";
format = "pretty";
pos = __curPos;
expected = pkgs.hello;
actual = pkgs.hello;
}
{ {
name = "test-drv"; name = "test-drv";
pos = __curPos; pos = __curPos;

View file

@ -19,9 +19,14 @@
if format == "json" if format == "json"
then actual then actual
else lib.generators.toPretty {} actual; else lib.generators.toPretty {} actual;
expected' =
if format == "json"
then expected
else lib.generators.toPretty {} expected;
in { in {
inherit type name description expected; inherit type name description;
actual = actual'; actual = actual';
expected = expected';
# discard string context, otherwise it's being built instantly which we don't want # discard string context, otherwise it's being built instantly which we don't want
actualDrv = builtins.unsafeDiscardStringContext (actualDrv.drvPath or ""); actualDrv = builtins.unsafeDiscardStringContext (actualDrv.drvPath or "");
pos = pos =