Skip to content

Commit

Permalink
tests/plugins/bufferline: test package options
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Aug 31, 2024
1 parent 0a3f093 commit bf57f24
Showing 1 changed file with 69 additions and 8 deletions.
77 changes: 69 additions & 8 deletions tests/test-sources/plugins/bufferlines/bufferline.nix
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down Expand Up @@ -124,10 +146,49 @@
};
};

no-packages = {
plugins.bufferline = {
enable = true;
iconsPackage = null;
no-packages =
{ config, ... }:
{
plugins.bufferline = {
enable = true;
iconsPackage = null;
};

assertions = [
{
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 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 =
config.extraPlugins != [ ]
&& !lib.any (
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";
}
];
};
};
}

0 comments on commit bf57f24

Please sign in to comment.