From 23a91967296c4e5180d9c01a2779f21688a494e4 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Fri, 30 Aug 2024 21:24:38 -0500 Subject: [PATCH] tests/plugins/bufferline: test package options --- .../plugins/bufferlines/bufferline.nix | 86 +++++++++++++++++-- 1 file changed, 81 insertions(+), 5 deletions(-) diff --git a/tests/test-sources/plugins/bufferlines/bufferline.nix b/tests/test-sources/plugins/bufferlines/bufferline.nix index 14b83b4bbf..6cbcf5e09c 100644 --- a/tests/test-sources/plugins/bufferlines/bufferline.nix +++ b/tests/test-sources/plugins/bufferlines/bufferline.nix @@ -1,3 +1,4 @@ +{ lib, pkgs, ... }: { empty = { plugins.bufferline.enable = true; @@ -124,10 +125,85 @@ }; }; - no-packages = { - plugins.bufferline = { - enable = true; - iconsPackage = null; + default-packages = + { config, ... }: + { + plugins.bufferline = { + enable = true; + }; + + assertions = [ + { + assertion = + config.extraPlugins != [ ] + -> lib.any ( + x: + lib.trace "${x.pname or x.name}" x.pname or x.name != null && x.pname or x.name == "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.name}" x.pname or x.name != null + && x.pname or x.name == "nvim-web-devicons" + ) config.extraPlugins; + message = "nvim-web-devicons package wasn't found when it was expected"; + } + ]; + }; + + no-packages = + { config, ... }: + { + plugins.bufferline = { + enable = true; + iconsPackage = null; + }; + + assertions = [ + { + assertion = + config.extraPlugins != [ ] + -> lib.any ( + x: + lib.trace "${x.pname or x.name}" x.pname or x.name != null + && x.pname or x.name != "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.name}" x.pname or x.name != null && x.pname or x.name == "mini.nvim" + ) config.extraPlugins; + message = "mini-nvim package wasn't found when it was expected"; + } + { + assertion = + config.extraPlugins != [ ] + -> lib.any ( + x: + lib.trace "${x.pname or x.name}" x.pname or x.name != null + && x.pname or x.name != "nvim-web-devicons" + ) config.extraPlugins; + message = "nvim-web-devicons package was found when it wasn't expected"; + } + ]; }; - }; }