Skip to content

Commit 4dddc83

Browse files
committed
Fix
1 parent 586f33c commit 4dddc83

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/ystdlib/error_handling/test-TraceableException.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <cassert>
22
#include <string>
3+
#include <string_view>
34
#include <system_error>
45

56
#include <ystdlib/error_handling/TraceableException.hpp>
@@ -9,7 +10,7 @@
910
#include "test-Defs.hpp"
1011

1112
namespace {
12-
constexpr auto cCustomFailureDescription{"This operation has failed."};
13+
constexpr std::string_view cCustomFailureDescription{"This operation has failed."};
1314

1415
class Worker {
1516
public:
@@ -22,7 +23,7 @@ class Worker {
2223
static auto execute_with_failure() -> void {
2324
throw OperationFailed(
2425
BinaryErrorCode{BinaryErrorCodeEnum::Failure},
25-
cCustomFailureDescription
26+
cCustomFailureDescription.data()
2627
);
2728
}
2829

@@ -31,25 +32,24 @@ class Worker {
3132
}
3233
};
3334

34-
constexpr auto cExecuteWithSuccessFunctionName{
35+
constexpr std::string_view cExecuteWithSuccessFunctionName{
3536
"static void {anonymous}::Worker::execute_with_success()"
3637
};
37-
constexpr auto cExecuteWithFailureFunctionName{
38+
constexpr std::string_view cExecuteWithFailureFunctionName{
3839
"static void {anonymous}::Worker::execute_with_failure()"
3940
};
40-
constexpr auto cExecuteWithInvalidArgsFunctionName{
41+
constexpr std::string_view cExecuteWithInvalidArgsFunctionName{
4142
"static void {anonymous}::Worker::execute_with_invalid_args()"
4243
};
43-
constexpr auto cInvalidArgsErrorMsg{"Invalid argument"};
44-
constexpr auto cExecuteWithSuccessLineNumber{19};
45-
constexpr auto cExecuteWithFailureLineNumber{26};
46-
constexpr auto cExecuteWithInvalidArgsLineNumber{30};
44+
constexpr std::string_view cInvalidArgsErrorMsg{"Invalid argument"};
45+
constexpr auto cExecuteWithSuccessLineNumber{20};
46+
constexpr auto cExecuteWithFailureLineNumber{27};
47+
constexpr auto cExecuteWithInvalidArgsLineNumber{31};
4748

4849
#ifdef SOURCE_PATH_SIZE
49-
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
50-
constexpr auto cRelativePathFileName{static_cast<char const*>(__FILE__) + SOURCE_PATH_SIZE};
50+
constexpr auto cRelativePathFileName{std::string_view{__FILE__}.substr(SOURCE_PATH_SIZE)};
5151
#else
52-
constexpr auto cRelativePathFileName{__FILE__};
52+
constexpr std::string_view cRelativePathFileName{__FILE__};
5353
#endif
5454

5555
template <typename Callable>

0 commit comments

Comments
 (0)