Fix warnings in test (#92)

* Convert tabs to spaces

* Remove extra semicolons in test

* Fix warnings in test

-Wreturn-type
-Wunused-parameter
-Wunused-value

* Fix -Wunused-variable warning in test

The variable 'failptr' is unused. From looking at the other variables in the
test case, it seems the fix is to first remove 'failptr' and then rename
'efail' to 'failptr'.

* Fix -Wunused-variable warning in test

* Fix -Wmacro-redefined warning in test

STATIC_REQUIRE has a previous definition in catch2/catch.hpp.
This commit is contained in:
Simon Truscott
2022-11-24 13:18:39 +00:00
committed by GitHub
parent cd8c7920b3
commit 2675ce3cd4
4 changed files with 21 additions and 20 deletions
+3 -3
View File
@@ -15,7 +15,7 @@ TEST_CASE("Issue 1", "[issues.1]") { getInt1(); }
tl::expected<int, int> operation1() { return 42; }
tl::expected<std::string, int> operation2(int const val) { return "Bananas"; }
tl::expected<std::string, int> operation2(int const val) { (void)val; return "Bananas"; }
TEST_CASE("Issue 17", "[issues.17]") {
auto const intermediate_result = operation1();
@@ -67,7 +67,7 @@ struct i31{
};
TEST_CASE("Issue 31", "[issues.31]") {
const tl::expected<i31, int> a = i31{42};
a->i;
(void)a->i;
tl::expected< void, std::string > result;
tl::expected< void, std::string > result2 = result;
@@ -77,7 +77,7 @@ TEST_CASE("Issue 31", "[issues.31]") {
TEST_CASE("Issue 33", "[issues.33]") {
tl::expected<void, int> res {tl::unexpect, 0};
REQUIRE(!res);
res = res.map_error([](int i) { return 42; });
res = res.map_error([](int i) { (void)i; return 42; });
REQUIRE(res.error() == 42);
}