11#include < gtest/gtest.h>
22
3+ #include < rfl.hpp>
34#include < string>
45#include < type_traits>
56
6- #include < rfl.hpp>
7-
87namespace test_result_cross_assign {
98
109TEST (regression, result_cross_type_assign_error_clears_success) {
1110 auto ok = rfl::Result<int >(42 );
1211 ASSERT_TRUE (ok);
1312
14- const auto err = rfl::Result<long >(rfl::Error (" fail" ));
13+ const auto err = rfl::Result<long >(rfl::error (" fail" ));
1514 ASSERT_FALSE (err);
1615
1716 ok = err;
18- EXPECT_FALSE (ok)
19- << " After assigning an error Result<long> to Result<int>, "
20- " the target should be falsy" ;
17+ EXPECT_FALSE (ok) << " After assigning an error Result<long> to Result<int>, "
18+ " the target should be falsy" ;
2119}
2220
2321} // namespace test_result_cross_assign
@@ -26,8 +24,8 @@ namespace test_result_value_or_return_type {
2624
2725TEST (regression, result_value_or_returns_value_not_rvalue_ref) {
2826 using ResultType = rfl::Result<std::string>;
29- using ReturnType = decltype (
30- std::declval<ResultType&&>().value_or (std::string (" default" )));
27+ using ReturnType =
28+ decltype ( std::declval<ResultType&&>().value_or (std::string (" default" )));
3129 constexpr bool returns_value = std::is_same_v<ReturnType, std::string>;
3230 EXPECT_TRUE (returns_value)
3331 << " Result::value_or(T&&) should return T by value, not T&&. "
@@ -40,13 +38,13 @@ namespace test_result_error_rvalue_return_type {
4038
4139TEST (regression, result_error_rvalue_qualified_returns_rvalue_ref) {
4240 using ResultType = rfl::Result<int >;
43- using ReturnType =
44- decltype (std::declval<ResultType&&>().error ());
41+ using ReturnType = decltype (std::declval<ResultType&&>().error ());
4542 constexpr bool returns_rvalue_ref = std::is_same_v<ReturnType, rfl::Error&&>;
4643 constexpr bool returns_lvalue_ref = std::is_same_v<ReturnType, rfl::Error&>;
4744 EXPECT_TRUE (returns_rvalue_ref)
4845 << " Result::error() && should return Error&&, not Error&. "
49- " Currently returns lvalue ref: " << returns_lvalue_ref;
46+ " Currently returns lvalue ref: "
47+ << returns_lvalue_ref;
5048}
5149
5250} // namespace test_result_error_rvalue_return_type
0 commit comments