diff options
author | Kaiden Fey <kookie@spacekookie.de> | 2020-09-21 14:12:32 +0200 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2020-09-21 14:12:32 +0200 |
commit | f80843dd45d7acd563d0a5b014cec3a2ea686fc2 (patch) | |
tree | 87189d873d6f932d85f9c1a480462b37d96cd6a5 /home-manager/tests/modules/programs/fish/functions.nix | |
parent | e0800985dab8f8ebb4cebdfd7e361fd1fafdb2a7 (diff) | |
parent | 9b1b55ba0264a55add4b7b4e022bdc2832b531f6 (diff) |
Merge commit '9b1b55ba0264a55add4b7b4e022bdc2832b531f6'
Diffstat (limited to 'home-manager/tests/modules/programs/fish/functions.nix')
-rw-r--r-- | home-manager/tests/modules/programs/fish/functions.nix | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/home-manager/tests/modules/programs/fish/functions.nix b/home-manager/tests/modules/programs/fish/functions.nix new file mode 100644 index 00000000000..424d0a288c7 --- /dev/null +++ b/home-manager/tests/modules/programs/fish/functions.nix @@ -0,0 +1,48 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + func = pkgs.writeText "func.fish" '' + function func + echo "Hello" + end + ''; + + funcEvent = pkgs.writeText "func-event.fish" '' + function func-event --on-event="fish_command_not_found" + echo "Not found!" + end + ''; + +in { + config = { + programs.fish = { + enable = true; + + functions = { + func = ''echo "Hello"''; + func-event = { + body = ''echo "Not found!"''; + onEvent = "fish_command_not_found"; + }; + }; + }; + + nmt = { + description = + "if fish.function is set, check file exists and contents match"; + script = '' + assertFileExists home-files/.config/fish/functions/func.fish + echo ${func} + assertFileContent home-files/.config/fish/functions/func.fish ${func} + + assertFileExists home-files/.config/fish/functions/func-event.fish + echo ${funcEvent} + assertFileContent home-files/.config/fish/functions/func-event.fish ${funcEvent} + ''; + + }; + }; +} |