|
| 1 | +let |
| 2 | + getFirstLazyPlugin = |
| 3 | + config: |
| 4 | + let |
| 5 | + inherit (config.plugins.lazy) plugins; |
| 6 | + in |
| 7 | + if plugins == [ ] then null else builtins.head plugins; |
| 8 | + |
| 9 | + getPluginKeys = plugin: if plugin != null && builtins.isList plugin.keys then plugin.keys else [ ]; |
| 10 | + getPluginCmd = plugin: if plugin != null && builtins.isList plugin.cmd then plugin.cmd else [ ]; |
| 11 | +in |
1 | 12 | { |
2 | 13 | lazy-load-neovim-plugin-configured = |
3 | 14 | { config, lib, ... }: |
|
18 | 29 | }; |
19 | 30 | }; |
20 | 31 |
|
21 | | - assertions = [ |
22 | | - { |
23 | | - assertion = (builtins.length config.plugins.lazy.plugins) == 1; |
24 | | - message = "`lazy.plugins` should have contained a single plugin configuration, but contained ${builtins.toJSON config.plugins.lz-n.plugins}"; |
25 | | - } |
26 | | - { |
27 | | - assertion = |
28 | | - let |
29 | | - plugins = config.plugins.lazy.plugins or [ ]; |
30 | | - plugin = if builtins.length plugins > 0 then builtins.head plugins else null; |
31 | | - cmd = if plugin != null && builtins.isList plugin.cmd then plugin.cmd else [ ]; |
32 | | - in |
33 | | - (builtins.length cmd) == 1; |
34 | | - message = "`lazy.plugins[0].cmd` should have contained a configuration."; |
35 | | - } |
36 | | - { |
37 | | - assertion = |
38 | | - let |
39 | | - plugins = config.plugins.lazy.plugins or [ ]; |
40 | | - plugin = if builtins.length plugins > 0 then builtins.head plugins else null; |
41 | | - in |
42 | | - plugin != null && config.plugins.neotest.settings == plugin.opts; |
43 | | - message = "`lazy.plugins[0].opts` should have contained `neotest` settings."; |
44 | | - } |
45 | | - ]; |
| 32 | + assertions = |
| 33 | + let |
| 34 | + plugin = getFirstLazyPlugin config; |
| 35 | + cmd = getPluginCmd plugin; |
| 36 | + in |
| 37 | + [ |
| 38 | + { |
| 39 | + assertion = (builtins.length config.plugins.lazy.plugins) == 1; |
| 40 | + message = "`lazy.plugins` should have contained a single plugin configuration, but contained ${builtins.toJSON config.plugins.lz-n.plugins}"; |
| 41 | + } |
| 42 | + { |
| 43 | + assertion = (builtins.length cmd) == 1; |
| 44 | + message = "`lazy.plugins[0].cmd` should have contained a configuration."; |
| 45 | + } |
| 46 | + { |
| 47 | + assertion = plugin != null && config.plugins.neotest.settings == plugin.opts; |
| 48 | + message = "`lazy.plugins[0].opts` should have contained `neotest` settings."; |
| 49 | + } |
| 50 | + ]; |
46 | 51 | }; |
47 | 52 |
|
48 | 53 | dont-lazy-load-unconfigured = |
|
85 | 90 | }; |
86 | 91 | }; |
87 | 92 |
|
88 | | - assertions = [ |
89 | | - { |
90 | | - assertion = (builtins.length config.plugins.lazy.plugins) == 1; |
91 | | - message = "`lazy.plugins` should have contained a single plugin configuration, but contained ${builtins.toJSON config.plugins.lz-n.plugins}"; |
92 | | - } |
93 | | - { |
94 | | - assertion = |
95 | | - let |
96 | | - plugins = config.plugins.lazy.plugins or [ ]; |
97 | | - plugin = if builtins.length plugins > 0 then builtins.head plugins else null; |
98 | | - cmd = if plugin != null && builtins.isList plugin.cmd then plugin.cmd else [ ]; |
99 | | - in |
100 | | - (builtins.length cmd) == 1; |
101 | | - message = "`lazy.plugins[0].cmd` should have contained a configuration."; |
102 | | - } |
103 | | - ]; |
| 93 | + assertions = |
| 94 | + let |
| 95 | + plugin = getFirstLazyPlugin config; |
| 96 | + cmd = getPluginCmd plugin; |
| 97 | + in |
| 98 | + [ |
| 99 | + { |
| 100 | + assertion = (builtins.length config.plugins.lazy.plugins) == 1; |
| 101 | + message = "`lazy.plugins` should have contained a single plugin configuration, but contained ${builtins.toJSON config.plugins.lz-n.plugins}"; |
| 102 | + } |
| 103 | + { |
| 104 | + assertion = (builtins.length cmd) == 1; |
| 105 | + message = "`lazy.plugins[0].cmd` should have contained a configuration."; |
| 106 | + } |
| 107 | + ]; |
104 | 108 | }; |
105 | 109 | } |
0 commit comments