diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /library/cpp/testing/unittest/checks.cpp | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'library/cpp/testing/unittest/checks.cpp')
-rw-r--r-- | library/cpp/testing/unittest/checks.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/library/cpp/testing/unittest/checks.cpp b/library/cpp/testing/unittest/checks.cpp new file mode 100644 index 00000000000..c5712ae9d21 --- /dev/null +++ b/library/cpp/testing/unittest/checks.cpp @@ -0,0 +1,31 @@ +#include <util/generic/string.h> +#include <util/string/type.h> + +bool CheckExceptionMessage(const char* msg, TString& err) { + static const char* badMsg[] = { + // Операция успешно завершена [cp1251] + "\xce\xef\xe5\xf0\xe0\xf6\xe8\xff\x20\xf3\xf1\xef\xe5\xf8\xed\xee\x20\xe7\xe0\xe2\xe5\xf0\xf8\xe5\xed\xe0", + "The operation completed successfully", + "No error"}; + + err.clear(); + + if (msg == nullptr) { + err = "Error message is null"; + return false; + } + + if (IsSpace(msg)) { + err = "Error message is empty"; + return false; + } + + for (auto& i : badMsg) { + if (strstr(msg, i) != nullptr) { + err = "Invalid error message: " + TString(msg); + return false; + } + } + + return true; +} |