mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-08 19:46:06 +01:00
tests/generated: add a separate error for unsupported entries
Only used for LSP packages, where we have a separate list of unsupported LSP servers in generated/unsupported-lspconfig-servers.json
This commit is contained in:
parent
5c6ee4186f
commit
308e5b3843
1 changed files with 9 additions and 7 deletions
|
|
@ -21,6 +21,8 @@ let
|
|||
declared,
|
||||
# A list of names generated by generate-files
|
||||
generated,
|
||||
# A list of names that are explicitly unsupported upstream
|
||||
unsupported ? [ ],
|
||||
# The filename where names are declared (used in error messages)
|
||||
declarationFile,
|
||||
}:
|
||||
|
|
@ -29,11 +31,14 @@ let
|
|||
loc: lib.optional (!lib.hasAttrByPath loc pkgs) (lib.concatStringsSep "." loc)
|
||||
) (builtins.map lib.toList packages);
|
||||
undeclared = lib.filter (name: !(lib.elem name declared)) generated;
|
||||
uselesslyDeclared = lib.filter (name: !(lib.elem name generated)) declared;
|
||||
uselesslyDeclared = lib.partition (name: lib.elem name unsupported) (
|
||||
lib.filter (name: !(lib.elem name generated)) declared
|
||||
);
|
||||
in
|
||||
describeErrors "${name}: The following are not found in `pkgs`, but are declared in ${declarationFile}:" missingFromPkgs
|
||||
++ describeErrors "${name}: The following are not declared in ${declarationFile}:" undeclared
|
||||
++ describeErrors "${name}: The following are not listed upstream, but are declared in ${declarationFile}:" uselesslyDeclared;
|
||||
++ describeErrors "${name}: The following are now unsupported upstream, but are declared in ${declarationFile}:" uselesslyDeclared.right
|
||||
++ describeErrors "${name}: The following are not listed upstream, but are declared in ${declarationFile}:" uselesslyDeclared.wrong;
|
||||
|
||||
# The error message provided to the derivation.
|
||||
# The test fails if this is non-empty.
|
||||
|
|
@ -50,11 +55,8 @@ let
|
|||
|
||||
declared = unpackaged ++ lib.attrsets.attrNames (packages // customCmd);
|
||||
|
||||
generated = lib.pipe ../generated/lspconfig-servers.json [
|
||||
lib.importJSON
|
||||
(builtins.map (lib.getAttr "name"))
|
||||
lib.lists.unique
|
||||
];
|
||||
generated = builtins.attrNames (lib.importJSON ../generated/lspconfig-servers.json);
|
||||
unsupported = lib.importJSON ../generated/unsupported-lspconfig-servers.json;
|
||||
}
|
||||
)
|
||||
++ checkDeclarations (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue