Fixed platform filtering.

This commit is contained in:
Judson 2017-05-12 09:44:39 -07:00
parent 07f781bd8d
commit 56d214b0ea
No known key found for this signature in database
GPG Key ID: 1817B08954BF0B7D
2 changed files with 5 additions and 4 deletions

@ -4,12 +4,10 @@ rec {
platformMatches = {rubyEngine, version, ...}@ruby: attrs: (
!(attrs ? "platforms") ||
builtins.trace "ruby engine: ${rubyEngine}"
builtins.trace "ruby version ${version.majMin}"
builtins.length attrs.platforms == 0 ||
builtins.any (platform:
builtins.trace "checking: ${platform.engine}/${platform.version}"
platform.engine == rubyEngine &&
(!(platform ? "version") || platform.version == version.majMin)
(!(platform ? "version") || platform.version.majMin == version.majMin)
) attrs.platforms
);

@ -41,6 +41,9 @@ let
( 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;}]; }; };
in
test.run "Filter matches on platform" gemSet (set: functions.filterGemset {inherit ruby; groups = [];} set == gemSet))