Current round of tests pass, but filter function is failing to include when groups match in use.
This commit is contained in:
@@ -5,44 +5,24 @@ nix-build -E 'with import <nixpkgs> { }; callPackage ./test.nix {}' --show-trace
|
||||
Confusingly, the ideal result ends with something like:
|
||||
error: build of ‘/nix/store/3245f3dcl2wxjs4rci7n069zjlz8qg85-test-results.tap.drv’ failed
|
||||
*/
|
||||
{ writeText, lib, ruby, defaultGemConfig, callPackage }:
|
||||
{ stdenv, writeText, lib, ruby, defaultGemConfig, callPackage }@defs:
|
||||
let
|
||||
test = import ./testing.nix;
|
||||
tap = import ./tap-support.nix;
|
||||
stubs = import ./stubs.nix defs;
|
||||
should = import ./assertions.nix { inherit test lib; };
|
||||
|
||||
bundlerEnv = callPackage ./default.nix {};
|
||||
basicEnv = callPackage ./basic.nix {};
|
||||
basicEnv = callPackage ./basic.nix stubs;
|
||||
bundlerEnv = callPackage ./default.nix stubs // {
|
||||
inherit basicEnv;
|
||||
};
|
||||
|
||||
testConfigs = {
|
||||
groups = ["default"];
|
||||
gemConfig = defaultGemConfig;
|
||||
confFiles = "./testConfs";
|
||||
};
|
||||
functions = (import ./functions.nix ({ inherit lib ruby; } // testConfigs));
|
||||
|
||||
should = {
|
||||
equal = expected: actual:
|
||||
if actual == expected then
|
||||
(test.passed "= ${toString expected}") else
|
||||
(test.failed "'${toString actual}'(${builtins.typeOf actual}) != '${toString expected}'(${builtins.typeOf expected})");
|
||||
|
||||
beASet = actual:
|
||||
if builtins.isAttrs actual then
|
||||
(test.passed "is a set") else
|
||||
(test.failed "is not a set, was ${builtins.typeOf actual}: ${toString actual}");
|
||||
|
||||
haveKeys = expected: actual:
|
||||
if builtins.all
|
||||
(ex: builtins.any (ac: ex == ac) (builtins.attrNames actual))
|
||||
expected then
|
||||
(test.passed "has expected keys") else
|
||||
(test.failed "keys differ: expected [${lib.concatStringsSep ";" expected}] have [${lib.concatStringsSep ";" (builtins.attrNames actual)}]");
|
||||
|
||||
havePrefix = expected: actual:
|
||||
if lib.hasPrefix expected actual then
|
||||
(test.passed "has prefix '${expected}'") else
|
||||
(test.failed "prefix '${expected}' not found in '${actual}'");
|
||||
};
|
||||
functions = (import ./functions.nix ({ inherit lib; ruby = stubs.ruby; } // testConfigs));
|
||||
|
||||
justName = bundlerEnv {
|
||||
name = "test";
|
||||
@@ -66,9 +46,9 @@ let
|
||||
[
|
||||
(should.haveKeys [ "name" "env" "postBuild" ])
|
||||
{
|
||||
name = should.equal "test-0.1.2";
|
||||
name = should.equal "test";
|
||||
env = should.beASet;
|
||||
postBuild = should.havePrefix "nananana";
|
||||
postBuild = should.havePrefix "/nix/store";
|
||||
}
|
||||
])
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user