nixpkgs/pkgs/development/ruby-modules/bundled-common/test.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

141 lines
2.5 KiB
Nix

{
lib,
ruby,
defaultGemConfig,
test,
should,
}:
let
testConfigs = {
inherit lib;
gemConfig = defaultGemConfig;
};
functions = (import ./functions.nix testConfigs);
in
builtins.concatLists [
(test.run "All set, no gemdir"
(functions.bundlerFiles {
gemfile = test/Gemfile;
lockfile = test/Gemfile.lock;
gemset = test/gemset.nix;
})
{
gemfile = should.equal test/Gemfile;
lockfile = should.equal test/Gemfile.lock;
gemset = should.equal test/gemset.nix;
}
)
(test.run "Just gemdir"
(functions.bundlerFiles {
gemdir = test/.;
})
{
gemfile = should.equal test/Gemfile;
lockfile = should.equal test/Gemfile.lock;
gemset = should.equal test/gemset.nix;
}
)
(test.run "Gemset and dir"
(functions.bundlerFiles {
gemdir = test/.;
gemset = test/extraGemset.nix;
})
{
gemfile = should.equal test/Gemfile;
lockfile = should.equal test/Gemfile.lock;
gemset = should.equal test/extraGemset.nix;
}
)
(test.run "Filter empty gemset" { } (
set:
functions.filterGemset {
inherit ruby;
groups = [ "default" ];
} set == { }
))
(
let
gemSet = {
test = {
groups = [
"x"
"y"
];
};
};
in
test.run "Filter matches a group" gemSet (
set:
functions.filterGemset {
inherit ruby;
groups = [
"y"
"z"
];
} set == gemSet
)
)
(
let
gemSet = {
test = {
platforms = [ ];
};
};
in
test.run "Filter matches empty platforms list" gemSet (
set:
functions.filterGemset {
inherit ruby;
groups = [ ];
} set == gemSet
)
)
(
let
gemSet = {
test = {
platforms = [
{
engine = ruby.rubyEngine;
version = ruby.version.majMin;
}
];
};
};
in
test.run "Filter matches on platform" gemSet (
set:
functions.filterGemset {
inherit ruby;
groups = [ ];
} set == gemSet
)
)
(
let
gemSet = {
test = {
groups = [
"x"
"y"
];
};
};
in
test.run "Filter excludes based on groups" gemSet (
set:
functions.filterGemset {
inherit ruby;
groups = [
"a"
"b"
];
} set == { }
)
)
]