Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/lua-loader: builtins.match -> lib.hasInfix #2028

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions tests/test-sources/modules/lua-loader.nix
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
{
# Test that nothing is configured by default
default.module =
{ config, ... }:
{ config, lib, ... }:
{
files."files_test.lua" = { };

assertions = [
{
assertion = builtins.match ".*vim\.loader.*" config.content == null;
assertion = !lib.hasInfix "vim.loader" config.content;
message = "No luaLoader configuration is expected in init.lua by default.";
}
{
assertion = builtins.match ".*vim\.loader.*" config.files."files_test.lua".content == null;
assertion = !lib.hasInfix "vim.loader" config.files."files_test.lua".content;
message = "No luaLoader configuration is expected in 'files' submodules.";
}
];
};

# Test lua loader enabled
# Test Lua loader enabled
enabled.module =
{ config, ... }:
{ config, lib, ... }:
{
luaLoader.enable = true;

files."files_test.lua" = { };

assertions = [
{
assertion = builtins.match ".*vim\.loader\.enable\(\).*" config.content != null;
assertion = lib.hasInfix "vim.loader.enable()" config.content;
message = "luaLoader is expected to be explicitly enabled.";
}
{
assertion = builtins.match ".*vim\.loader.*" config.files."files_test.lua".content == null;
assertion = !lib.hasInfix "vim.loader" config.files."files_test.lua".content;
message = "No luaLoader configuration is expected in 'files' submodules.";
}
];
};

# Test lua loader disabled
# Test Lua loader disabled
disabled.module =
{ config, ... }:
{ config, lib, ... }:
{
luaLoader.enable = false;

files."files_test.lua" = { };

assertions = [
{
assertion = builtins.match ".*vim\.loader\.disable\(\).*" config.content != null;
assertion = lib.hasInfix "vim.loader.disable()" config.content;
message = "luaLoader is expected to be explicitly disabled.";
}
{
assertion = builtins.match ".*vim\.loader.*" config.files."files_test.lua".content == null;
assertion = !lib.hasInfix "vim.loader." config.files."files_test.lua".content;
message = "No luaLoader configuration is expected in 'files' submodules.";
}
];
Expand Down