From 6c0646e1d6050338aa20c8eecb00c7e5f96b4afe Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sun, 24 Nov 2024 18:03:06 +0100 Subject: tests(tests/nvim-checkhealth): Init --- flake/default.nix | 3 ++ tests/by-name/nv/nvim-checkhealth/test.desc | 22 +++++++++++++++ tests/by-name/nv/nvim-checkhealth/test.nix | 44 +++++++++++++++++++++++++++++ tests/default.nix | 3 ++ 4 files changed, 72 insertions(+) create mode 100644 tests/by-name/nv/nvim-checkhealth/test.desc create mode 100644 tests/by-name/nv/nvim-checkhealth/test.nix diff --git a/flake/default.nix b/flake/default.nix index 222b18ac..ded656e7 100644 --- a/flake/default.nix +++ b/flake/default.nix @@ -66,6 +66,9 @@ extraModules = { termfilechooser = "${nixpkgs_open_prs.nixpkgs-tfc}/nixos/modules/config/xdg/portals/termfilechooser.nix"; + nixvim = { + homeManagerModule = nixVim.homeManagerModules.nixvim; + }; agenix = agenix.nixosModules.default; disko = disko.nixosModules.default; serverphone = serverphone.nixosModules.default; diff --git a/tests/by-name/nv/nvim-checkhealth/test.desc b/tests/by-name/nv/nvim-checkhealth/test.desc new file mode 100644 index 00000000..66f87cf4 --- /dev/null +++ b/tests/by-name/nv/nvim-checkhealth/test.desc @@ -0,0 +1,22 @@ +# Give the shell time to start up +Sleep 2 + +# We open a `*.norg` file to run the norg ftplugin. +Type nvim test.norg --headless "+set nospell" "+checkhealth" "+w! health.log" +q +wa +qa +Sleep 0.5 +Type Enter + +# TODO: The test system should be able to just wait until a command has finished. <2024-11-23> +# Wait until `nvim` has collected the health check. +Sleep 240 + +# The `checkhealth` output is not reproducible. +# Thus only output the warnings/errors. +Type batgrep --ignore-case 'warning|error' health.log > new_golden +Sleep 0.5 +Type Enter +Sleep 2 + +SetGolden new_golden + +# vim: ft=tape diff --git a/tests/by-name/nv/nvim-checkhealth/test.nix b/tests/by-name/nv/nvim-checkhealth/test.nix new file mode 100644 index 00000000..d84a2627 --- /dev/null +++ b/tests/by-name/nv/nvim-checkhealth/test.nix @@ -0,0 +1,44 @@ +{ + mkTest, + extraModules, + pkgs, + ... +}: +mkTest { + name = "nvim-checkhealth"; + + configuration = { + imports = [ + ../../../../modules/by-name/nv/nvim/module.nix + ../../../../modules/by-name/ni/nixpkgs/module.nix + ]; + config = { + soispha = { + nixpkgs = { + enable = true; + systemName = "x86_64-linux"; + }; + programs.nvim = { + enable = true; + shell = pkgs.zsh; + }; + }; + home-manager.users.soispha = { + home.packages = [ + pkgs.bat + pkgs.ripgrep + pkgs.bat-extras.batgrep + ]; + imports = [ + extraModules.nixvim.homeManagerModule + ]; + }; + }; + }; + + testData = {}; + + description = ./test.desc; + + hash = "4927ff94c6e9fb0dcb25c8e3e30f3e489cab5bb0a054656776af19725308bfe1"; +} diff --git a/tests/default.nix b/tests/default.nix index 9803c99c..1f2ea049 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -26,6 +26,9 @@ import value { inherit mkTest + extraModules + pkgs + myPkgs ; }; }; -- cgit 1.4.1