diff options
author | Sergei Krivonos <sergei.krivonos@mariadb.com> | 2021-11-08 21:11:05 +0200 |
---|---|---|
committer | Sergei Krivonos <sergeikrivonos@gmail.com> | 2021-11-09 12:06:49 +0200 |
commit | e9b76b896a5cec9804e653f7df117c49284cabba (patch) | |
tree | 504c4ffc94d76ccd1fd0aacc3f4bffaa7307942a /sql/my_json_writer.h | |
parent | 5e988ff80f51e80f4d74477c4a22a065472317d4 (diff) | |
download | mariadb-git-e9b76b896a5cec9804e653f7df117c49284cabba.tar.gz |
MDEV-23766: fix by my_json_writer test
Diffstat (limited to 'sql/my_json_writer.h')
-rw-r--r-- | sql/my_json_writer.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sql/my_json_writer.h b/sql/my_json_writer.h index 6f9ae73c5ee..c8bd7f5b8fa 100644 --- a/sql/my_json_writer.h +++ b/sql/my_json_writer.h @@ -17,9 +17,12 @@ #define JSON_WRITER_INCLUDED #include "my_base.h" +#if !defined(NDEBUG) || defined(JSON_WRITER_UNIT_TEST) +#include <vector> +#endif + #ifdef JSON_WRITER_UNIT_TEST #include "sql_string.h" -#include <vector> // Also, mock objects are defined in my_json_writer-t.cc #define VALIDITY_ASSERT(x) if ((!x)) this->invalid_json= true; #else @@ -200,7 +203,7 @@ private: class Json_writer { -#ifndef NDEBUG +#if !defined(NDEBUG) || defined(JSON_WRITER_UNIT_TEST) /* In debug mode, Json_writer will fail and assertion if one attempts to produce an invalid JSON document (e.g. JSON array having named elements). @@ -244,7 +247,6 @@ private: void add_unquoted_str(const char* val, size_t len); bool on_add_str(const char *str, size_t num_bytes); - bool on_start_array(); void on_start_object(); public: @@ -264,7 +266,7 @@ public: size_t get_truncated_bytes() { return output.get_truncated_bytes(); } Json_writer() : -#ifndef NDEBUG +#if !defined(NDEBUG) || defined(JSON_WRITER_UNIT_TEST) got_name(false), #endif indent_level(0), document_start(true), element_started(false), |