Skip to content

Commit 59e1a02

Browse files
committed
tests/plugins/bufferline: test package options
1 parent 910a77a commit 59e1a02

File tree

1 file changed

+62
-1
lines changed

1 file changed

+62
-1
lines changed

tests/test-sources/plugins/bufferlines/bufferline.nix

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{ lib, pkgs, ... }:
12
{
23
empty = {
34
plugins.bufferline.enable = true;
@@ -124,10 +125,70 @@
124125
};
125126
};
126127

127-
no-packages = {
128+
default-packages = cfg: {
129+
plugins.bufferline = {
130+
enable = true;
131+
};
132+
133+
assertions = [
134+
{
135+
assertion =
136+
cfg.config.extraPlugins != [ ]
137+
-> lib.any (
138+
x:
139+
lib.trace "${x.pname or x.name}" x.pname or x.name != null
140+
&& x.pname or x.name == "nvim-web-devicons"
141+
) cfg.config.extraPlugins;
142+
message = "nvim-web-devicons package wasn't found when it was expected";
143+
}
144+
];
145+
};
146+
147+
no-packages = cfg: {
128148
plugins.bufferline = {
129149
enable = true;
130150
iconsPackage = null;
131151
};
152+
153+
assertions = [
154+
{
155+
assertion =
156+
cfg.config.extraPlugins != [ ]
157+
-> lib.any (
158+
x:
159+
lib.trace "${x.pname or x.name}" x.pname or x.name != null
160+
&& x.pname or x.name != "nvim-web-devicons"
161+
) cfg.config.extraPlugins;
162+
message = "nvim-web-devicons package was found when it wasn't expected";
163+
}
164+
];
165+
};
166+
167+
package-overrides = cfg: {
168+
plugins.bufferline = {
169+
enable = true;
170+
iconsPackage = pkgs.vimPlugins.mini-nvim;
171+
};
172+
173+
assertions = [
174+
{
175+
assertion =
176+
cfg.config.extraPlugins != [ ]
177+
-> lib.any (
178+
x: lib.trace "${x.pname or x.name}" x.pname or x.name != null && x.pname or x.name == "mini.nvim"
179+
) cfg.config.extraPlugins;
180+
message = "mini-nvim package wasn't found when it was expected";
181+
}
182+
{
183+
assertion =
184+
cfg.config.extraPlugins != [ ]
185+
-> lib.any (
186+
x:
187+
lib.trace "${x.pname or x.name}" x.pname or x.name != null
188+
&& x.pname or x.name != "nvim-web-devicons"
189+
) cfg.config.extraPlugins;
190+
message = "nvim-web-devicons package was found when it wasn't expected";
191+
}
192+
];
132193
};
133194
}

0 commit comments

Comments
 (0)