test: Add a test to check that all types match the 'type'-type

This commit is contained in:
Vincent Ambo 2019-08-28 14:31:45 +01:00
parent b622bcef7d
commit cb45536124

View file

@ -1,5 +1,5 @@
with (import ./yants.nix {});
with builtins; with builtins;
with (import ./yants.nix {});
# Note: Derivations are not included in the tests below as they cause # Note: Derivations are not included in the tests below as they cause
# issues with deepSeq. # issues with deepSeq.
@ -68,4 +68,18 @@ deepSeq rec {
(name: age: "${name} is ${toString age} years old"); (name: age: "${name} is ${toString age} years old");
testFunc = func "Brynhjulf" 42; testFunc = func "Brynhjulf" 42;
# Test that all types are types.
testTypes = map type [
any bool drv float int string
(attrs int)
(either int string)
(enum [ "foo" "bar" ])
(list string)
(option int)
(option (list string))
(struct { a = int; b = option string; })
(sum { a = int; b = option string; })
];
} "All tests passed!\n" } "All tests passed!\n"