From ae612f824918c336de906fd99048366a83591bdb Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Fri, 27 Dec 2024 14:39:20 +0000 Subject: [PATCH] tests: use warning-expectations options Deprecated the old `test.check*` options. --- modules/top-level/test.nix | 3 +++ .../plugins/by-name/nvim-osc52/default.nix | 15 +++++++++++---- .../plugins/by-name/rust-tools/default.nix | 18 ++++++++++++------ 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/modules/top-level/test.nix b/modules/top-level/test.nix index 787a01cbe4..938aa07f6f 100644 --- a/modules/top-level/test.nix +++ b/modules/top-level/test.nix @@ -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; }; diff --git a/tests/test-sources/plugins/by-name/nvim-osc52/default.nix b/tests/test-sources/plugins/by-name/nvim-osc52/default.nix index 4d913fcbb8..b256babed7 100644 --- a/tests/test-sources/plugins/by-name/nvim-osc52/default.nix +++ b/tests/test-sources/plugins/by-name/nvim-osc52/default.nix @@ -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 = { @@ -20,7 +28,6 @@ }; }; - # Hide warnings, since this plugin is deprecated - test.checkWarnings = false; + test = { inherit warnings; }; }; } diff --git a/tests/test-sources/plugins/by-name/rust-tools/default.nix b/tests/test-sources/plugins/by-name/rust-tools/default.nix index 77245d99ef..c891998db9 100644 --- a/tests/test-sources/plugins/by-name/rust-tools/default.nix +++ b/tests/test-sources/plugins/by-name/rust-tools/default.nix @@ -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"; @@ -77,8 +84,7 @@ }; rust-analyzer-options = { - # Plugin deprecated - test.checkWarnings = false; + test = { inherit warnings; }; plugins.rust-tools = { enable = true; server = {