diff --git a/flake-modules/tests.nix b/flake-modules/tests.nix index 27755fb8..eb1f8419 100644 --- a/flake-modules/tests.nix +++ b/flake-modules/tests.nix @@ -25,6 +25,11 @@ inherit (self.lib.${system}.check) mkTestDerivationFromNixvimModule; }; + failing-tests = import ../tests/failing-tests.nix { + inherit pkgs; + inherit (self.lib.${system}.check) mkTestDerivationFromNixvimModule; + }; + no-flake = import ../tests/no-flake.nix { inherit system; inherit (self.lib.${system}.check) mkTestDerivationFromNvim; diff --git a/tests/failing-tests.nix b/tests/failing-tests.nix new file mode 100644 index 00000000..383eb988 --- /dev/null +++ b/tests/failing-tests.nix @@ -0,0 +1,22 @@ +{ + pkgs, + mkTestDerivationFromNixvimModule, +}: +let + inherit (pkgs.testers) testBuildFailure; + + failed = testBuildFailure (mkTestDerivationFromNixvimModule { + name = "prints-hello-world"; + module = { + extraConfigLua = '' + print('Hello, world!') + ''; + }; + inherit pkgs; + }); +in +pkgs.runCommand "failing-test" { inherit failed; } '' + grep -F 'Hello, world!' "$failed/testBuildFailure.log" + [[ 1 = $(cat "$failed/testBuildFailure.exit") ]] + touch $out +''