From b78b584368be76cd9a24449f3be2b0a13cf55e3f Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Fri, 8 Oct 2021 21:10:35 -0300 Subject: [PATCH] tests: fix test.assert.assertions.enable not working Co-authored-by: Robert Helgesson --- tests/asserts.nix | 60 +++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/tests/asserts.nix b/tests/asserts.nix index 6d1b10022..c1fe177ee 100644 --- a/tests/asserts.nix +++ b/tests/asserts.nix @@ -37,37 +37,45 @@ with lib; }; }; - config = mkIf config.test.asserts.warnings.enable { - home.file = { - "asserts/warnings.actual".text = concatStringsSep '' + config = mkMerge [ + (mkIf config.test.asserts.warnings.enable { + home.file = { + "asserts/warnings.actual".text = concatStringsSep '' - -- - '' config.warnings; + -- + '' config.warnings; + }; - "asserts/assertions.actual".text = concatStringsSep '' + nmt.script = '' + assertFileContent \ + home-files/asserts/warnings.actual \ + ${ + pkgs.writeText "warnings.expected" (concatStringsSep '' - -- - '' (map (x: x.message) (filter (x: !x.assertion) config.assertions)); - }; + -- + '' config.test.asserts.warnings.expected) + } + ''; + }) - nmt.script = '' - assertFileContent \ - home-files/asserts/warnings.actual \ - ${ - pkgs.writeText "warnings.expected" (concatStringsSep '' + (mkIf config.test.asserts.assertions.enable { + home.file = { + "asserts/assertions.actual".text = concatStringsSep '' - -- - '' config.test.asserts.warnings.expected) - } + -- + '' (map (x: x.message) (filter (x: !x.assertion) config.assertions)); + }; - assertFileContent \ - home-files/asserts/assertions.actual \ - ${ - pkgs.writeText "assertions.expected" (concatStringsSep '' + nmt.script = '' + assertFileContent \ + home-files/asserts/assertions.actual \ + ${ + pkgs.writeText "assertions.expected" (concatStringsSep '' - -- - '' config.test.asserts.assertions.expected) - } - ''; - }; + -- + '' config.test.asserts.assertions.expected) + } + ''; + }) + ]; }