tests: remove special case for efmls-configs

This commit is contained in:
Matt Sturgeon 2024-08-22 11:31:57 +01:00
parent 06419627e2
commit 087f70cb0a
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
2 changed files with 95 additions and 98 deletions

View file

@ -41,21 +41,8 @@ let
testsList = lib.lists.flatten (parseDirectories root [ ]); testsList = lib.lists.flatten (parseDirectories root [ ]);
testsListEvaluated = builtins.map ( testsListEvaluated = builtins.map (
{ cases, namespace }@args: { cases, ... }@args:
if builtins.isAttrs cases then if builtins.isFunction cases then args // { cases = cases { inherit pkgs lib helpers; }; } else args
args
else
{
# cases is a function
cases = cases {
inherit pkgs helpers;
efmls-options = import ../plugins/lsp/language-servers/efmls-configs.nix {
inherit pkgs lib helpers;
config = { };
};
};
inherit namespace;
}
) testsList; ) testsList;
# Take a list of test cases (i.e the content of a file) and prepare a test case that can be # Take a list of test cases (i.e the content of a file) and prepare a test case that can be

View file

@ -1,17 +1,26 @@
{ efmls-options, pkgs, ... }:
{ {
empty = { empty = {
plugins.efmls-configs.enable = true; plugins.efmls-configs.enable = true;
}; };
all = { all =
plugins.efmls-configs = {
lib,
options,
pkgs,
...
}:
let let
options = efmls-options.options.plugins.efmls-configs; inherit (pkgs.stdenv.hostPlatform) system;
inherit (options.plugins.efmls-configs) setup;
# toolOptions is an attrsets of the form: # toolOptions is an attrsets of the form:
# { <lang> = { linter = tools; formatter = tools; }; } # { <lang> = { linter = tools; formatter = tools; }; }
# Where tools is the option type representing the valid tools for this language # Where tools is the option type representing the valid tools for this language
toolOptions = (builtins.head options.setup.type.getSubModules).options; toolOptions = builtins.removeAttrs (setup.type.getSubOptions setup.loc) [
"_freeformOptions"
"_module"
];
brokenTools = brokenTools =
[ [
@ -19,18 +28,18 @@
# TODO: re-enable this tests when fixed # TODO: re-enable this tests when fixed
"cpplint" "cpplint"
] ]
++ pkgs.lib.optionals (pkgs.stdenv.hostPlatform.system == "aarch64-linux") [ ++ lib.optionals (system == "aarch64-linux") [
# Broken as of 2024-07-13 # Broken as of 2024-07-13
# TODO: re-enable this tests when fixed # TODO: re-enable this tests when fixed
"textlint" "textlint"
] ]
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ ++ lib.optionals pkgs.stdenv.isDarwin [
# As of 2024-01-04, texliveMedium is broken on darwin # As of 2024-01-04, texliveMedium is broken on darwin
# TODO: re-enable those tests when fixed # TODO: re-enable those tests when fixed
"chktex" "chktex"
"latexindent" "latexindent"
] ]
++ pkgs.lib.optionals (pkgs.stdenv.hostPlatform.system == "x86_64-darwin") [ ++ lib.optionals (system == "x86_64-darwin") [
# As of 2024-07-31, dmd is broken on x86_64-darwin # As of 2024-07-31, dmd is broken on x86_64-darwin
# https://github.com/NixOS/nixpkgs/pull/331373 # https://github.com/NixOS/nixpkgs/pull/331373
# TODO: re-enable this test when fixed # TODO: re-enable this test when fixed
@ -66,11 +75,11 @@
"swiftlint" "swiftlint"
"xo" "xo"
] ]
++ (pkgs.lib.optionals pkgs.stdenv.isDarwin [ "clazy" ]) ++ lib.optionals pkgs.stdenv.isDarwin [ "clazy" ]
++ (pkgs.lib.optionals pkgs.stdenv.isAarch64 [ ++ lib.optionals pkgs.stdenv.isAarch64 [
"dmd" "dmd"
"smlfmt" "smlfmt"
]); ];
# Fetch the valid enum members from the tool options # Fetch the valid enum members from the tool options
toolsFromOptions = toolsFromOptions =
@ -88,6 +97,7 @@
builtins.filter (t: !builtins.elem t (brokenTools ++ unpackaged)) toolList; builtins.filter (t: !builtins.elem t (brokenTools ++ unpackaged)) toolList;
in in
{ {
plugins.efmls-configs = {
enable = true; enable = true;
# Replace the { <lang> = { linter = tools; formatter = tools; } }; # Replace the { <lang> = { linter = tools; formatter = tools; } };