Skip to content

Commit

Permalink
testers.testEqualArrayOrMap: inline let expression
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorBaker committed Feb 27, 2025
1 parent 5b5c499 commit a527799
Showing 1 changed file with 29 additions and 35 deletions.
64 changes: 29 additions & 35 deletions pkgs/build-support/testers/testEqualArrayOrMap/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,39 @@
lib,
stdenvNoCC,
}:
let
inherit (lib) maintainers;
inherit (lib.asserts) assertMsg;
inherit (lib.customisation) makeOverridable;
lib.makeOverridable (
{
name,
valuesArray ? null,
valuesMap ? null,
expectedArray ? null,
expectedMap ? null,
script,
}:
assert lib.assertMsg (
expectedArray != null || expectedMap != null
) "testEqualArrayOrMap: at least one of 'expectedArray' or 'expectedMap' must be provided";
stdenvNoCC.mkDerivation {
__structuredAttrs = true;
strictDeps = true;

testEqualArrayOrMap =
{
name,
valuesArray ? null,
valuesMap ? null,
expectedArray ? null,
expectedMap ? null,
script,
}:
assert assertMsg (
expectedArray != null || expectedMap != null
) "testEqualArrayOrMap: at least one of 'expectedArray' or 'expectedMap' must be provided";
stdenvNoCC.mkDerivation {
__structuredAttrs = true;
strictDeps = true;
inherit name;

inherit name;
nativeBuildInputs = [
./assert-equal-array.sh
./assert-equal-map.sh
];

nativeBuildInputs = [
./assert-equal-array.sh
./assert-equal-map.sh
];
inherit valuesArray valuesMap;
inherit expectedArray expectedMap;

inherit valuesArray valuesMap;
inherit expectedArray expectedMap;
inherit script;

inherit script;
buildCommandPath = ./build-command.sh;

buildCommandPath = ./build-command.sh;

meta = {
description = "Tests for equality of bash arrays (including associative arrays)";
maintainers = [ maintainers.connorbaker ];
};
meta = {
description = "Tests for equality of bash arrays (including associative arrays)";
maintainers = [ lib.maintainers.connorbaker ];
};
in
makeOverridable testEqualArrayOrMap
}
)

0 comments on commit a527799

Please sign in to comment.