diff options
author | Owen McGrath <7798336+owm111@users.noreply.github.com> | 2020-04-18 13:22:09 -0500 |
---|---|---|
committer | Robert Helgesson <robert@rycee.net> | 2020-04-23 22:41:22 +0200 |
commit | 2f2a4396c617f843e8e9adf74687e73d592a80ab (patch) | |
tree | 0fe1928a884de9896a7ab26f42634b91baf0fb64 /tests | |
parent | cb17f1ede2fe777c1d879dc99c8d242a80985ff2 (diff) |
lf: add module
Adds 'programs.lf', configuration managment for lf, a terminal file
manager.
PR #1174
Diffstat (limited to 'tests')
-rw-r--r-- | tests/default.nix | 1 | ||||
-rw-r--r-- | tests/modules/programs/lf/all-options.nix | 86 | ||||
-rw-r--r-- | tests/modules/programs/lf/default.nix | 5 | ||||
-rw-r--r-- | tests/modules/programs/lf/minimal-options.nix | 18 | ||||
-rw-r--r-- | tests/modules/programs/lf/no-pv-keybind.nix | 43 |
5 files changed, 153 insertions, 0 deletions
diff --git a/tests/default.nix b/tests/default.nix index e3897580293..00ad24989a3 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -33,6 +33,7 @@ import nmt { ./modules/programs/git ./modules/programs/gpg ./modules/programs/kakoune + ./modules/programs/lf ./modules/programs/lieer ./modules/programs/mbsync ./modules/programs/neomutt diff --git a/tests/modules/programs/lf/all-options.nix b/tests/modules/programs/lf/all-options.nix new file mode 100644 index 00000000000..a25467a26b7 --- /dev/null +++ b/tests/modules/programs/lf/all-options.nix @@ -0,0 +1,86 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + pvScript = builtins.toFile "pv.sh" "cat $1"; + expected = builtins.toFile "settings-expected" '' + set icons + set noignorecase + set ratios "2:2:3" + set tabstop 4 + + cmd added :echo "foo" + cmd multiline :{{ + push gg + echo "bar" + push i + }} + cmd removed + + map aa should-be-added + map ab + + cmap <c-a> should-be-added + cmap <c-b> + + set previewer ${pvScript} + map i ${"$"}${pvScript} "$f" | less -R + + + + # More config... + + ''; +in { + config = { + programs.lf = { + enable = true; + + cmdKeybindings = { + "<c-a>" = "should-be-added"; + "<c-b>" = null; + }; + + commands = { + added = '':echo "foo"''; + removed = null; + multiline = '' + :{{ + push gg + echo "bar" + push i + }}''; + }; + + extraConfig = '' + # More config... + ''; + + keybindings = { + aa = "should-be-added"; + ab = null; + }; + + previewer = { + keybinding = "i"; + source = pvScript; + }; + + settings = { + ignorecase = false; + icons = true; + tabstop = 4; + ratios = "2:2:3"; + }; + }; + + nixpkgs.overlays = + [ (self: super: { lf = pkgs.writeScriptBin "dummy-lf" ""; }) ]; + + nmt.script = '' + assertFileExists home-files/.config/lf/lfrc + assertFileContent home-files/.config/lf/lfrc ${expected} + ''; + }; +} diff --git a/tests/modules/programs/lf/default.nix b/tests/modules/programs/lf/default.nix new file mode 100644 index 00000000000..65cf24fcf60 --- /dev/null +++ b/tests/modules/programs/lf/default.nix @@ -0,0 +1,5 @@ +{ + lf-all-options = ./all-options.nix; + lf-minimal-options = ./minimal-options.nix; + lf-no-pv-keybind = ./no-pv-keybind.nix; +} diff --git a/tests/modules/programs/lf/minimal-options.nix b/tests/modules/programs/lf/minimal-options.nix new file mode 100644 index 00000000000..b3c26ba9b57 --- /dev/null +++ b/tests/modules/programs/lf/minimal-options.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let expected = builtins.toFile "settings-expected" "\n\n\n\n\n\n\n\n\n\n\n"; +in { + config = { + programs.lf = { enable = true; }; + + nixpkgs.overlays = + [ (self: super: { lf = pkgs.writeScriptBin "dummy-lf" ""; }) ]; + + nmt.script = '' + assertFileExists home-files/.config/lf/lfrc + assertFileContent home-files/.config/lf/lfrc ${expected} + ''; + }; +} diff --git a/tests/modules/programs/lf/no-pv-keybind.nix b/tests/modules/programs/lf/no-pv-keybind.nix new file mode 100644 index 00000000000..524a41a3643 --- /dev/null +++ b/tests/modules/programs/lf/no-pv-keybind.nix @@ -0,0 +1,43 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + pvScript = builtins.toFile "pv.sh" "cat $1"; + expected = builtins.toFile "settings-expected" '' + + + + + + + + + set previewer ${pvScript} + + + + # More config... + + ''; +in { + config = { + programs.lf = { + enable = true; + + extraConfig = '' + # More config... + ''; + + previewer = { source = pvScript; }; + }; + + nixpkgs.overlays = + [ (self: super: { lf = pkgs.writeScriptBin "dummy-lf" ""; }) ]; + + nmt.script = '' + assertFileExists home-files/.config/lf/lfrc + assertFileContent home-files/.config/lf/lfrc ${expected} + ''; + }; +} |