From 1923ac3358cbd2d75352c2db2178314eb4623818 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Wed, 4 Sep 2019 12:46:04 +0200 Subject: [PATCH] rofi: add test to verify assertion --- tests/default.nix | 1 + ...ert-on-both-theme-and-colors-expected.json | 1 + .../rofi/assert-on-both-theme-and-colors.nix | 33 +++++++++++++++++++ tests/modules/programs/rofi/default.nix | 3 ++ 4 files changed, 38 insertions(+) create mode 100644 tests/modules/programs/rofi/assert-on-both-theme-and-colors-expected.json create mode 100644 tests/modules/programs/rofi/assert-on-both-theme-and-colors.nix create mode 100644 tests/modules/programs/rofi/default.nix diff --git a/tests/default.nix b/tests/default.nix index 3d0d23b9..ef63c7bf 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -36,6 +36,7 @@ import nmt { // import ./modules/misc/pam // import ./modules/misc/xsession // import ./modules/programs/firefox + // import ./modules/programs/rofi // import ./modules/systemd ) // import ./modules/home-environment diff --git a/tests/modules/programs/rofi/assert-on-both-theme-and-colors-expected.json b/tests/modules/programs/rofi/assert-on-both-theme-and-colors-expected.json new file mode 100644 index 00000000..808288f4 --- /dev/null +++ b/tests/modules/programs/rofi/assert-on-both-theme-and-colors-expected.json @@ -0,0 +1 @@ +["Cannot use the rofi options 'theme' and 'colors' simultaneously.\n"] \ No newline at end of file diff --git a/tests/modules/programs/rofi/assert-on-both-theme-and-colors.nix b/tests/modules/programs/rofi/assert-on-both-theme-and-colors.nix new file mode 100644 index 00000000..2558a258 --- /dev/null +++ b/tests/modules/programs/rofi/assert-on-both-theme-and-colors.nix @@ -0,0 +1,33 @@ +{ config, lib, ... }: + +with lib; + +{ + config = { + programs.rofi = { + enable = true; + theme = "foo"; + colors = { + window = { + background = "background"; + border = "border"; + separator = "separator"; + }; + rows = { + }; + }; + }; + + home.file.result.text = + builtins.toJSON + (map (a: a.message) + (filter (a: !a.assertion) + config.assertions)); + + nmt.script = '' + assertFileContent \ + home-files/result \ + ${./assert-on-both-theme-and-colors-expected.json} + ''; + }; +} diff --git a/tests/modules/programs/rofi/default.nix b/tests/modules/programs/rofi/default.nix new file mode 100644 index 00000000..b42b43e9 --- /dev/null +++ b/tests/modules/programs/rofi/default.nix @@ -0,0 +1,3 @@ +{ + rofi-assert-on-both-theme-and-colors = import ./assert-on-both-theme-and-colors.nix; +}