nix-git/modules/wallpaper-test.nix

22 lines
626 B
Nix
Raw Permalink Normal View History

2024-09-04 22:13:38 +02:00
# To inspect ./wallpaper.nix, adjust the `expr` of the two tests below and then run the following command:
# nix --extra-experimental-features nix-command eval --show-trace --impure --expr 'import ./modules/wallpaper-test.nix {}'
#
# Source: https://www.tweag.io/blog/2022-09-01-unit-test-your-nix-code/
{ pkgs ? import <nixpkgs> {} }:
let
inherit (pkgs) lib;
inherit (lib) runTests;
math = import ./wallpaper.nix {inherit lib pkgs;};
in
runTests {
test1 = {
expr = pkgs.lib.attrNames math;
expected = true;
};
test2 = {
expr = "${math.out}/img.jpg";
expected = true;
};
}