Skip to content

Commit

Permalink
tests: use warning-expectations options
Browse files Browse the repository at this point in the history
Deprecated the old `test.check*` options.
  • Loading branch information
MattSturgeon committed Dec 27, 2024
1 parent 24e3b11 commit ae612f8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
3 changes: 3 additions & 0 deletions modules/top-level/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,15 @@ in
checkWarnings = lib.mkOption {
type = lib.types.bool;
description = "Whether to check `config.warnings` in the test.";
apply = x: lib.warnIfNot x "`test.checkWarnings = false` is replaced with `test.warnings = [ ]`." x;
default = true;
};

checkAssertions = lib.mkOption {
type = lib.types.bool;
description = "Whether to check `config.assertions` in the test.";
apply =
x: lib.warnIfNot x "`test.checkAssertions = false` is replaced with `test.assertions = [ ]`." x;
default = true;
};

Expand Down
15 changes: 11 additions & 4 deletions tests/test-sources/plugins/by-name/nvim-osc52/default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
let
expect = expect: value: { inherit expect value; };

# This plugin is deprecated
warnings = [
(expect "count" 1)
(expect "any" "this plugin is obsolete and will be removed after 24.11.")
];
in
{
empty = {
plugins.nvim-osc52.enable = true;

# Hide warnings, since this plugin is deprecated
test.checkWarnings = false;
test = { inherit warnings; };
};

defaults = {
Expand All @@ -20,7 +28,6 @@
};
};

# Hide warnings, since this plugin is deprecated
test.checkWarnings = false;
test = { inherit warnings; };
};
}
18 changes: 12 additions & 6 deletions tests/test-sources/plugins/by-name/rust-tools/default.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
let
expect = expect: value: { inherit expect value; };

# This plugin is deprecated
warnings = [
(expect "count" 1)
(expect "any" "The `rust-tools` project has been abandoned.")
];
in
{
empty = {
# Plugin deprecated
test.checkWarnings = false;
test = { inherit warnings; };
plugins.rust-tools.enable = true;
};

defaults = {
# Plugin deprecated
test.checkWarnings = false;
test = { inherit warnings; };
plugins.rust-tools = {
enable = true;
executor = "termopen";
Expand Down Expand Up @@ -77,8 +84,7 @@
};

rust-analyzer-options = {
# Plugin deprecated
test.checkWarnings = false;
test = { inherit warnings; };
plugins.rust-tools = {
enable = true;
server = {
Expand Down

0 comments on commit ae612f8

Please sign in to comment.