From 21f7ed6eb617089f9ea7251303a2567e8ab43e29 Mon Sep 17 00:00:00 2001 From: Stanislav Asunkin <1353637+stasjok@users.noreply.github.com> Date: Sun, 13 Oct 2024 09:28:12 +0300 Subject: [PATCH] tests/modules/output: test that init.lua contains all config sections This test was removed in 3d1224a039d70098c78d263b0867352d95f2194b to remove IFD. Rewrite the test using `pkgs.runCommandLocal` and grep. --- tests/test-sources/modules/output.nix | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tests/test-sources/modules/output.nix b/tests/test-sources/modules/output.nix index 24295dec..b3d4f85f 100644 --- a/tests/test-sources/modules/output.nix +++ b/tests/test-sources/modules/output.nix @@ -46,13 +46,27 @@ "test.vim" = configs; }; - # Plugin configs - # TODO: Test this makes it to the nvim configuration - # NOTE: config.content currently does not contain extraPlugins config extraPlugins = [ { - plugin = pkgs.emptyDirectory; config = "let g:var = 'neovimRcContent5'"; + + # Test that final init.lua contains all config sections + plugin = pkgs.runCommandLocal "init-lua-content-test" { } '' + test_content() { + if ! grep -qF "$1" "${config.build.initFile}"; then + echo "init.lua should contain $2" >&2 + exit 1 + fi + } + + test_content extraConfigLuaPre1 extraConfigLuaPre + test_content extraConfigLua2 extraConfigLua + test_content extraConfigLuaPost3 extraConfigLuaPost + test_content extraConfigVim4 extraConfigVim4 + test_content neovimRcContent5 neovimRcContent + + touch $out + ''; } ];