blob: 3f77eb1fb43e4820c2ba452f7cee8a05b73e06a9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
{ writeText, lib, ruby, defaultGemConfig, callPackage }:
let
test = import ./testing.nix;
tap = import ./tap-support.nix;
bundlerEnv = callPackage ./default.nix {};
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}");
};
justName = bundlerEnv {
name = "test";
gemset = ./test/gemset.nix;
};
pnamed = bundlerEnv {
pname = "test";
gemset = ./test/gemset.nix;
};
results = builtins.concatLists [
(test.run "Filter empty gemset" {} (set: functions.filterGemset set == {}))
(test.run "bundlerEnv { name }" justName {
name = should.equal "test";
})
(test.run "bundlerEnv { pname }" pnamed
{
name = should.equal "test-0.1.2";
env = should.beASet;
})
];
in
writeText "test-results.tap" (tap.output results)
|