From e4407dca229e23379b088d94f6b64ea3ec762300 Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <github@naumov.de>
Date: Fri, 2 Jul 2021 18:38:24 +0200
Subject: [PATCH] [T/BL] Avoid unreachable code warning.

The FAIL() call does not return, so the for-loop
increment is not executed causing the warning to
appear.
---
 Tests/BaseLib/TestConfigTree.cpp | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/Tests/BaseLib/TestConfigTree.cpp b/Tests/BaseLib/TestConfigTree.cpp
index bd8828b9aff..41c2e087d0a 100644
--- a/Tests/BaseLib/TestConfigTree.cpp
+++ b/Tests/BaseLib/TestConfigTree.cpp
@@ -360,11 +360,10 @@ TEST(BaseLibConfigTree, GetSubtreeList)
     {
         auto const conf = makeConfigTree(ptree, cbs);
 
-        for (auto p : conf.getConfigSubtreeList("nonexistent_list"))
-        {
-            (void)p;
-            FAIL() << "Expected empty list";
-        }
+        auto const expected_empty_list =
+            conf.getConfigParameterList("nonexistent_list");
+        ASSERT_TRUE(expected_empty_list.empty()) << "Expected empty list";
+
         EXPECT_ERR_WARN(cbs, false, false);
 
         int i = 0;
@@ -392,11 +391,10 @@ TEST(BaseLibConfigTree, GetParamList)
     {
         auto const conf = makeConfigTree(ptree, cbs);
 
-        for (auto p : conf.getConfigParameterList("nonexistent_list"))
-        {
-            (void)p;
-            FAIL() << "Expected empty list";
-        }
+        auto const expected_empty_list =
+            conf.getConfigParameterList("nonexistent_list");
+        ASSERT_TRUE(expected_empty_list.empty()) << "Expected empty list";
+
         EXPECT_ERR_WARN(cbs, false, false);
 
         int i = 0;
@@ -442,11 +440,10 @@ TEST(BaseLibConfigTree, GetValueList)
     {
         auto const conf = makeConfigTree(ptree, cbs);
 
-        for (auto p : conf.getConfigParameterList<int>("nonexistent_list"))
-        {
-            (void)p;
-            FAIL() << "Expected empty list";
-        }
+        auto const expected_empty_list =
+            conf.getConfigParameterList<int>("nonexistent_list");
+        ASSERT_TRUE(expected_empty_list.empty()) << "Expected empty list";
+
         EXPECT_ERR_WARN(cbs, false, false);
 
         int n = 0;
-- 
GitLab