tests: remove special treatment of module

Since we no longer need to extract `tests.dontRun` from an attrset, we
no longer need the "special" `module` attr.
This commit is contained in:
Matt Sturgeon 2024-08-20 00:54:50 +01:00
parent 7b2a6cd9e6
commit 123a55ed6f
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
14 changed files with 266 additions and 285 deletions

View file

@ -25,7 +25,7 @@ let
[
{
name = "main";
case = builtins.removeAttrs config.programs.nixvim [
module = builtins.removeAttrs config.programs.nixvim [
# This is not available to standalone modules, only HM & NixOS Modules
"enable"
# This is purely an example, it does not reflect a real usage
@ -41,17 +41,12 @@ lib.pipe (testFiles ++ [ exampleFiles ]) [
(builtins.map (
file:
let
# The test case can either be the actual definition,
# or a child attr named `module`.
prepareModule = case: if lib.isFunction case then case else case.module or case;
mkTest =
{ name, case }:
{ name, module }:
{
inherit name;
path = mkTestDerivationFromNixvimModule {
inherit name;
module = prepareModule case;
inherit name module;
pkgs = pkgsUnfree;
};
};

View file

@ -64,7 +64,7 @@ let
{ namespace, cases }:
{
name = lib.strings.concatStringsSep "-" namespace;
cases = lib.mapAttrsToList (name: case: { inherit case name; }) cases;
cases = lib.mapAttrsToList (name: module: { inherit module name; }) cases;
};
in
# A list of the form [ { name = "..."; modules = [ /* test cases */ ]; } ]

View file

@ -15,9 +15,7 @@ let
};
in
{
top-level = {
inherit module;
};
top-level = module;
files-module = {
files."libtest.lua" = module;

View file

@ -39,7 +39,7 @@
};
};
default-empty.module =
default-empty =
{ config, ... }:
{
files.test = { };

View file

@ -1,6 +1,6 @@
{
# Test that nothing is configured by default
default.module =
default =
{ config, lib, ... }:
{
files."files_test.lua" = { };
@ -18,7 +18,7 @@
};
# Test Lua loader enabled
enabled.module =
enabled =
{ config, lib, ... }:
{
luaLoader.enable = true;
@ -38,7 +38,7 @@
};
# Test Lua loader disabled
disabled.module =
disabled =
{ config, lib, ... }:
{
luaLoader.enable = false;

View file

@ -6,7 +6,7 @@
};
# Test that all extraConfigs are present in output
all-configs.module =
all-configs =
{
config,
pkgs,
@ -64,7 +64,7 @@
++ mkConfigAssertions "test.vim" config.files."test.vim".content;
};
files-default-empty.module =
files-default-empty =
{ config, helpers, ... }:
{
files = {

View file

@ -24,7 +24,7 @@ let
'';
in
{
default.module =
default =
{ config, ... }:
{
performance.byteCompileLua.enable = true;
@ -107,7 +107,7 @@ in
};
disabled.module =
disabled =
{ config, ... }:
{
performance.byteCompileLua.enable = false;

View file

@ -9,7 +9,7 @@ let
in
{
# Test basic functionality
default.module =
default =
{ config, ... }:
{
performance.combinePlugins.enable = true;
@ -40,7 +40,7 @@ in
};
# Test disabled option
disabled.module =
disabled =
{ config, ... }:
{
performance.combinePlugins.enable = false;
@ -57,7 +57,7 @@ in
};
# Test that plugin dependencies are handled
dependencies.module =
dependencies =
{ config, ... }:
{
performance.combinePlugins.enable = true;
@ -84,7 +84,7 @@ in
};
# Test that pathsToLink option works
paths-to-link.module =
paths-to-link =
{ config, ... }:
{
performance.combinePlugins = {
@ -112,7 +112,7 @@ in
};
# Test that plugin python3 dependencies are handled
python-dependencies.module =
python-dependencies =
{ config, ... }:
{
performance.combinePlugins.enable = true;
@ -139,7 +139,7 @@ in
};
# Test that optional plugins are handled
optional-plugins.module =
optional-plugins =
{ config, ... }:
{
performance.combinePlugins.enable = true;
@ -197,7 +197,7 @@ in
};
# Test that plugin configs are handled
configs.module =
configs =
{ config, ... }:
{
performance.combinePlugins.enable = true;
@ -240,7 +240,7 @@ in
};
# Test that config.filesPlugin is not combined
files-plugin.module =
files-plugin =
{ config, ... }:
{
performance.combinePlugins.enable = true;
@ -310,7 +310,7 @@ in
};
# Test that standalonePlugins option works
standalone-plugins.module =
standalone-plugins =
{ config, ... }:
{
performance.combinePlugins = {

View file

@ -1,7 +1,6 @@
{ pkgs, ... }:
{
all-sources = {
module =
all-sources =
{ config, ... }:
{
plugins = {
@ -37,5 +36,4 @@
};
};
};
};
}

View file

@ -3,8 +3,7 @@
plugins.coq-nvim.enable = true;
};
nixvim-defaults = {
module =
nixvim-defaults =
{ pkgs, ... }:
{
plugins.coq-nvim = {
@ -19,7 +18,6 @@
};
};
};
};
artifacts = {
plugins.coq-nvim = {

View file

@ -98,8 +98,7 @@
};
};
with-sources = {
module =
with-sources =
{
config,
options,
@ -164,5 +163,4 @@
) options.plugins.none-ls.sources;
};
};
};
}

View file

@ -26,8 +26,7 @@ in
};
# single-plugin and priority of plugins.lz-n.settings to globals.lz-n
example-single-plugin = {
module =
example-single-plugin =
{ pkgs, lib, ... }:
{
extraPlugins = optionalPlugins [ pkgs.vimPlugins.neo-tree-nvim ];
@ -63,10 +62,8 @@ in
];
};
};
};
example-multiple-plugin = {
module =
example-multiple-plugin =
{ pkgs, lib, ... }:
{
extraPlugins =
@ -166,5 +163,4 @@ in
];
};
};
};
}

View file

@ -18,9 +18,7 @@
};
};
combine-plugins.module =
{ config, ... }:
{
combine-plugins = {
plugins.telescope.enable = true;
performance.combinePlugins.enable = true;

View file

@ -26,7 +26,7 @@
};
};
check-alias.module =
check-alias =
{ config, ... }:
{
assertions = [