From 447f80f67648d956c453aafa873d0026c5563454 Mon Sep 17 00:00:00 2001 From: Bart Bakker Date: Thu, 29 Jul 2021 14:38:01 +0200 Subject: [PATCH] htop: verify htoprc contents for example settings test Fix ending the generated htoprc with a newline. --- modules/programs/htop.nix | 3 ++- tests/modules/programs/htop/example-htoprc.txt | 11 +++++++++++ tests/modules/programs/htop/example-settings.nix | 4 +++- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 tests/modules/programs/htop/example-htoprc.txt diff --git a/modules/programs/htop.nix b/modules/programs/htop.nix index a6cf4865a..e6177e228 100644 --- a/modules/programs/htop.nix +++ b/modules/programs/htop.nix @@ -146,7 +146,8 @@ in { home.packages = [ pkgs.htop ]; xdg.configFile."htop/htoprc" = mkIf (cfg.settings != { }) { - text = concatStringsSep "\n" (mapAttrsToList formatOption cfg.settings); + text = concatStringsSep "\n" (mapAttrsToList formatOption cfg.settings) + + "\n"; }; }; } diff --git a/tests/modules/programs/htop/example-htoprc.txt b/tests/modules/programs/htop/example-htoprc.txt new file mode 100644 index 000000000..ff06ed5ea --- /dev/null +++ b/tests/modules/programs/htop/example-htoprc.txt @@ -0,0 +1,11 @@ +color_scheme=6 +cpu_count_from_one=0 +delay=15 +fields=0 48 17 18 38 39 40 2 46 47 49 1 +highlight_base_name=1 +highlight_megabytes=1 +highlight_threads=1 +left_meter_modes=1 1 1 2 +left_meters=AllCPUs2 Memory Swap Zram +right_meter_modes=2 2 2 2 +right_meters=Tasks LoadAverage Uptime Systemd diff --git a/tests/modules/programs/htop/example-settings.nix b/tests/modules/programs/htop/example-settings.nix index 66698c844..8705e4b48 100644 --- a/tests/modules/programs/htop/example-settings.nix +++ b/tests/modules/programs/htop/example-settings.nix @@ -37,7 +37,9 @@ with lib; ]); nmt.script = '' - assertFileExists home-files/.config/htop/htoprc + htoprc=home-files/.config/htop/htoprc + assertFileExists $htoprc + assertFileContent $htoprc ${./example-htoprc.txt} ''; }; }