mirror of
https://codeberg.org/privacy1st/nix-git
synced 2024-12-23 02:36:05 +01:00
22 lines
626 B
Nix
22 lines
626 B
Nix
# 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;
|
|
};
|
|
} |