diff --git a/flake.nix b/flake.nix index ee51b97..c22746d 100644 --- a/flake.nix +++ b/flake.nix @@ -99,6 +99,13 @@ }; }; } + { + name = "pretty-unit"; + format = "pretty"; + pos = __curPos; + expected = pkgs.hello; + actual = pkgs.hello; + } { name = "test-drv"; pos = __curPos; diff --git a/lib/default.nix b/lib/default.nix index 79fec2b..458fdc8 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -19,9 +19,14 @@ if format == "json" then actual else lib.generators.toPretty {} actual; + expected' = + if format == "json" + then expected + else lib.generators.toPretty {} expected; in { - inherit type name description expected; + inherit type name description; actual = actual'; + expected = expected'; # discard string context, otherwise it's being built instantly which we don't want actualDrv = builtins.unsafeDiscardStringContext (actualDrv.drvPath or ""); pos =