From aed2769f77a349891303149d467d6735d77a1497 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Mon, 1 Jul 2024 22:27:03 +0800 Subject: [PATCH] wrapper-manager-fds/tests: init for library set --- tests/default.nix | 9 +++++++++ tests/lib/default.nix | 12 ++++++++++++ tests/lib/env/default.nix | 29 +++++++++++++++++++++++++++++ tests/lib/env/wrapper-fastfetch.nix | 7 +++++++ tests/lib/env/wrapper-neofetch.nix | 11 +++++++++++ 5 files changed, 68 insertions(+) create mode 100644 tests/default.nix create mode 100644 tests/lib/default.nix create mode 100644 tests/lib/env/default.nix create mode 100644 tests/lib/env/wrapper-fastfetch.nix create mode 100644 tests/lib/env/wrapper-neofetch.nix diff --git a/tests/default.nix b/tests/default.nix new file mode 100644 index 0000000..539c82d --- /dev/null +++ b/tests/default.nix @@ -0,0 +1,9 @@ +{ branch ? "nixos-stable" }: + +let + sources = import ../npins; + pkgs = import sources.${branch} { }; +in +{ + lib = import ./lib { inherit pkgs; }; +} diff --git a/tests/lib/default.nix b/tests/lib/default.nix new file mode 100644 index 0000000..e775297 --- /dev/null +++ b/tests/lib/default.nix @@ -0,0 +1,12 @@ +{ pkgs }: + +let + lib = import ../../lib { inherit pkgs; }; + callLib = file: import file { + inherit (pkgs) lib; inherit pkgs; + self = lib; + }; +in +{ + env = callLib ./env; +} diff --git a/tests/lib/env/default.nix b/tests/lib/env/default.nix new file mode 100644 index 0000000..b2da63d --- /dev/null +++ b/tests/lib/env/default.nix @@ -0,0 +1,29 @@ +{ pkgs, lib, self }: + +lib.runTests { + testsBuildSampleConfiguration = { + expr = + let + sampleConf = self.env.build { + inherit pkgs; + modules = [ ./wrapper-neofetch.nix ]; + specialArgs.yourMomName = "Joe Mama"; + }; + in + lib.isDerivation sampleConf.config.build.toplevel; + expected = true; + }; + + testsBuildSampleConfiguration2 = { + expr = + let + sampleConf = self.env.build { + inherit pkgs; + modules = [ ./wrapper-fastfetch.nix ]; + specialArgs.yourMomName = "Joe Mama"; + }; + in + lib.isDerivation sampleConf.config.build.toplevel; + expected = true; + }; +} diff --git a/tests/lib/env/wrapper-fastfetch.nix b/tests/lib/env/wrapper-fastfetch.nix new file mode 100644 index 0000000..c7af5ab --- /dev/null +++ b/tests/lib/env/wrapper-fastfetch.nix @@ -0,0 +1,7 @@ +{ lib, pkgs, ... }: + +{ + arg0 = lib.getExe' pkgs.fastfetch "fastfetch"; + appendArgs = [ "--logo" "Guix" ]; + env.NO_COLOR = "1"; +} diff --git a/tests/lib/env/wrapper-neofetch.nix b/tests/lib/env/wrapper-neofetch.nix new file mode 100644 index 0000000..5092d04 --- /dev/null +++ b/tests/lib/env/wrapper-neofetch.nix @@ -0,0 +1,11 @@ +{ lib, pkgs, yourMomName, ... }: + +{ + arg0 = lib.getExe' pkgs.neofetch "neofetch"; + executableName = yourMomName; + appendArgs = [ + "--ascii_distro" "guix" + "--title_fqdn" "off" + "--os_arch" "off" + ]; +}