diff options
author | 2023-03-18 21:43:51 +0300 | |
---|---|---|
committer | 2023-03-18 21:43:51 +0300 | |
commit | 4f73205da7dd88635fdaf2e6033870deeddb32a1 (patch) | |
tree | 0430385f2e362961966d69c11ae406440a7411a0 /test/regexmanager.cpp | |
parent | 00aa491ca0616e3a16474d548bea5ca274b6ab7d (diff) | |
download | newsboat-4f73205da7dd88635fdaf2e6033870deeddb32a1.tar.gz newsboat-4f73205da7dd88635fdaf2e6033870deeddb32a1.tar.zst newsboat-4f73205da7dd88635fdaf2e6033870deeddb32a1.zip |
Reduce scope of some variables in tests
This fixes a cppcheck warning.
Diffstat (limited to '')
-rw-r--r-- | test/regexmanager.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/regexmanager.cpp b/test/regexmanager.cpp index 3d4be5e9..b40cb224 100644 --- a/test/regexmanager.cpp +++ b/test/regexmanager.cpp @@ -11,9 +11,9 @@ using namespace newsboat; TEST_CASE("RegexManager throws on invalid command", "[RegexManager]") { RegexManager rxman; - std::vector<std::string> params; SECTION("on invalid command") { + std::vector<std::string> params; REQUIRE_THROWS_AS( rxman.handle_action("an-invalid-command", params), ConfigHandlerException); @@ -1030,7 +1030,6 @@ TEST_CASE("insert_style_tags() does not crash on invalid input", "[RegexManager]") { RegexManager rxman; - std::string input = "test this"; SECTION("tags with a position outside of the string are ignored") { std::map<size_t, std::string> tags = { @@ -1038,6 +1037,7 @@ TEST_CASE("insert_style_tags() does not crash on invalid input", {9, "<in>"}, {10, "<out>"}, }; + std::string input = "test this"; const std::string output = "<test>test this<in>"; rxman.insert_style_tags(input, tags); REQUIRE(input == output); @@ -1114,10 +1114,10 @@ TEST_CASE("merge_style_tag() does not crash on invalid input", "[RegexManager]") { RegexManager rxman; - std::map<size_t, std::string> tags; - const std::string new_tag = "<test>"; SECTION("ignore tag merging if `end <= start`") { + std::map<size_t, std::string> tags; + const std::string new_tag = "<test>"; rxman.merge_style_tag(tags, new_tag, 0, 0); rxman.merge_style_tag(tags, new_tag, 1, 0); rxman.merge_style_tag(tags, new_tag, 5, 4); |