From d5752079053091e65b99eb52fbb747050bbb08e8 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Fri, 2 Jun 2023 00:41:29 +0200 Subject: Flake: Add nixtest --- Documentation/INSTALLING.md | 5 +++++ flake.lock | Bin 6348 -> 6792 bytes flake.nix | 5 +++++ tests/testing_test.nix | 14 ++++++++++++++ 4 files changed, 24 insertions(+) create mode 100644 tests/testing_test.nix diff --git a/Documentation/INSTALLING.md b/Documentation/INSTALLING.md index 880845a..31ebefa 100644 --- a/Documentation/INSTALLING.md +++ b/Documentation/INSTALLING.md @@ -57,3 +57,8 @@ $ nix build .#isoConfigurations.$HOST-$HARDWARE-$ARCH.config.system.build.isoIma ``` # deploy -s .#$HOST-$HARDWARE-$ARCH --hostname $TARGET_IP ``` + +## Testing +``` +$ nix eval .#tests +``` diff --git a/flake.lock b/flake.lock index 3867d3e..2f7bf9e 100644 Binary files a/flake.lock and b/flake.lock differ diff --git a/flake.nix b/flake.nix index 6e1cb82..f77b46e 100644 --- a/flake.nix +++ b/flake.nix @@ -20,6 +20,8 @@ nur.url = "github:nix-community/NUR"; + nixtest.url = "github:jetpack-io/nixtest"; + nix-index.url = "github:Mic92/nix-index-database"; hosts = { @@ -117,5 +119,8 @@ # This is highly advised, and will prevent many possible mistakes checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib; + + + tests = inputs.nixtest.run ./.; }; } diff --git a/tests/testing_test.nix b/tests/testing_test.nix new file mode 100644 index 0000000..b977fc0 --- /dev/null +++ b/tests/testing_test.nix @@ -0,0 +1,14 @@ +let + lib = import ./lib.nix; +in [ + { + name = "Test function concatenate"; + actual = lib.concatenate "a" "b"; + expected = "ab"; + } + { + name = "Test function add"; + actual = lib.add 1 2; + expected = 3; + } +] -- cgit 1.4.1