From b3af91d293ef1178ad426306495c7a85ad8b8c9d Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Mon, 21 Feb 2022 21:17:22 +0000 Subject: [PATCH] tests/nnn: fix tests (#2746) There seems to be some changes on how wrapped binaries are implemented on nixpkgs. This broke the nnn tests since the tests were coupled with the old implementation. This commit fix the tests, and also make it less coupled by just testing if the bookmarks/plugins/environment variables are available. --- tests/modules/programs/nnn/nnn.nix | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/tests/modules/programs/nnn/nnn.nix b/tests/modules/programs/nnn/nnn.nix index aeb7d3fc5..7a01fd854 100644 --- a/tests/modules/programs/nnn/nnn.nix +++ b/tests/modules/programs/nnn/nnn.nix @@ -24,6 +24,8 @@ test.stubs = { nnnDummy.buildScript = '' + runHook preInstall + mkdir -p "$out/bin" touch "$out/bin/nnn" chmod +x "$out/bin/nnn" @@ -40,17 +42,13 @@ script = '' assertDirectoryExists home-files/.config/nnn/plugins - assertFileRegex \ - home-path/bin/nnn \ - "^export NNN_BMS='D:~/Downloads;d:~/Documents;p:~/Pictures;v:~/Videos'\''${NNN_BMS:+':'}\$NNN_BMS$" + for bookmark in 'export NNN_BMS' '~/Downloads' '~/Documents' '~/Pictures' '~/Videos'; do + assertFileRegex home-path/bin/nnn "$bookmark" + done - assertFileRegex \ - home-path/bin/nnn \ - "^export NNN_PLUG='c:fzcd;f:finder;v:imgview'\''${NNN_PLUG:+':'}\$NNN_PLUG$" - - assertFileRegex \ - home-path/bin/nnn \ - "/nix/store/.*-"{foo,bar}"/bin" + for plugin in 'export NNN_PLUG' 'fzcd' 'finder' 'imgview'; do + assertFileRegex home-path/bin/nnn "$plugin" + done ''; }; };