From 0a3f093e23cadb30501f4a17ff863af18a816d68 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Fri, 30 Aug 2024 21:12:50 -0500 Subject: [PATCH 1/2] tests/plugins/packer: test package options --- tests/test-sources/plugins/pluginmanagers/packer.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/test-sources/plugins/pluginmanagers/packer.nix b/tests/test-sources/plugins/pluginmanagers/packer.nix index 732a4ba0b3..e788091bbe 100644 --- a/tests/test-sources/plugins/pluginmanagers/packer.nix +++ b/tests/test-sources/plugins/pluginmanagers/packer.nix @@ -1,3 +1,4 @@ +{ lib, pkgs, ... }: { # Empty configuration empty = { @@ -136,10 +137,19 @@ }; }; - no-packages = { + no-packages = cfg: { plugins.packer = { enable = true; gitPackage = null; }; + + assertions = [ + { + assertion = lib.all ( + x: lib.trace "${x.pname or ""}" x.pname or null != "git" + ) cfg.config.extraPackages; + message = "A git package found when it wasn't expected"; + } + ]; }; } From a65a8910f7514c6c1bf53b52623a4b097e187fe8 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Fri, 30 Aug 2024 21:24:38 -0500 Subject: [PATCH 2/2] tests/plugins/bufferline: test package options --- .../plugins/bufferlines/bufferline.nix | 73 +++++++++++++++++-- 1 file changed, 65 insertions(+), 8 deletions(-) diff --git a/tests/test-sources/plugins/bufferlines/bufferline.nix b/tests/test-sources/plugins/bufferlines/bufferline.nix index 14b83b4bbf..7dca0e6a33 100644 --- a/tests/test-sources/plugins/bufferlines/bufferline.nix +++ b/tests/test-sources/plugins/bufferlines/bufferline.nix @@ -1,7 +1,29 @@ +{ lib, pkgs, ... }: { - empty = { - plugins.bufferline.enable = true; - }; + empty = + { config, ... }: + { + plugins.bufferline.enable = true; + + assertions = [ + { + assertion = + config.extraPlugins != [ ] + && lib.any ( + x: lib.trace "${x.pname or ""}" x.pname or null == "bufferline.nvim" + ) config.extraPlugins; + message = "bufferline package wasn't found when it was expected"; + } + { + assertion = + config.extraPlugins != [ ] + && lib.any ( + x: lib.trace "${x.pname or ""}" x.pname or null == "nvim-web-devicons" + ) config.extraPlugins; + message = "nvim-web-devicons package wasn't found when it was expected"; + } + ]; + }; example = { plugins.bufferline = { @@ -124,10 +146,45 @@ }; }; - no-packages = { - plugins.bufferline = { - enable = true; - iconsPackage = null; + no-packages = + { config, ... }: + { + plugins.bufferline = { + enable = true; + iconsPackage = null; + }; + + assertions = [ + { + assertion = lib.all ( + x: lib.trace "${x.pname or ""}" x.pname or null != "nvim-web-devicons" + ) config.extraPlugins; + message = "nvim-web-devicons package was found when it wasn't expected"; + } + ]; + }; + + package-overrides = + { config, ... }: + { + plugins.bufferline = { + enable = true; + iconsPackage = pkgs.vimPlugins.mini-nvim; + }; + + assertions = [ + { + assertion = + config.extraPlugins != [ ] + && lib.any (x: lib.trace "${x.pname or ""}" x.pname or null == "mini.nvim") config.extraPlugins; + message = "mini-nvim package wasn't found when it was expected"; + } + { + assertion = lib.all ( + x: lib.trace "${x.pname or ""}" x.pname or null != "nvim-web-devicons" + ) config.extraPlugins; + message = "nvim-web-devicons package was found when it wasn't expected"; + } + ]; }; - }; }