mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-27036: re-enable my_json_writer-t unit test
This commit is contained in:
@@ -13,13 +13,10 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
|
||||
|
||||
#include "mariadb.h"
|
||||
#include "sql_priv.h"
|
||||
#include "sql_string.h"
|
||||
#include "my_global.h"
|
||||
#include "my_json_writer.h"
|
||||
|
||||
#if !defined(NDEBUG) || defined(JSON_WRITER_UNIT_TEST)
|
||||
#include <iostream>
|
||||
|
||||
bool Json_writer::named_item_expected() const
|
||||
{
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#define JSON_WRITER_INCLUDED
|
||||
|
||||
#include "my_base.h"
|
||||
#include "sql_select.h"
|
||||
#include "sql_string.h"
|
||||
|
||||
#if !defined(NDEBUG) || defined(JSON_WRITER_UNIT_TEST) || defined ENABLED_JSON_WRITER_CONSISTENCY_CHECKS
|
||||
#include <set>
|
||||
@@ -27,11 +27,11 @@
|
||||
#endif
|
||||
|
||||
#ifdef JSON_WRITER_UNIT_TEST
|
||||
#include "sql_string.h"
|
||||
constexpr uint FAKE_SELECT_LEX_ID= UINT_MAX;
|
||||
// Also, mock objects are defined in my_json_writer-t.cc
|
||||
#define VALIDITY_ASSERT(x) if (!(x)) this->invalid_json= true;
|
||||
#else
|
||||
#include "sql_class.h" // For class THD
|
||||
#include "log.h" // for sql_print_error
|
||||
#define VALIDITY_ASSERT(x) DBUG_ASSERT(x)
|
||||
#endif
|
||||
|
||||
@@ -40,8 +40,10 @@ constexpr uint FAKE_SELECT_LEX_ID= UINT_MAX;
|
||||
class Opt_trace_stmt;
|
||||
class Opt_trace_context;
|
||||
class Json_writer;
|
||||
struct TABLE_LIST;
|
||||
|
||||
struct TABLE;
|
||||
struct st_join_table;
|
||||
using JOIN_TAB= struct st_join_table;
|
||||
|
||||
/*
|
||||
Single_line_formatting_helper is used by Json_writer to do better formatting
|
||||
|
@@ -74,7 +74,6 @@ class Json_writer;
|
||||
*************************************************************************************/
|
||||
|
||||
|
||||
const uint FAKE_SELECT_LEX_ID= UINT_MAX;
|
||||
|
||||
class Explain_query;
|
||||
|
||||
|
@@ -334,6 +334,8 @@
|
||||
#define UNCACHEABLE_DEPENDENT (UNCACHEABLE_DEPENDENT_GENERATED | \
|
||||
UNCACHEABLE_DEPENDENT_INJECTED)
|
||||
|
||||
#define FAKE_SELECT_LEX_ID UINT_MAX
|
||||
|
||||
/* Used to check GROUP BY list in the MODE_ONLY_FULL_GROUP_BY mode */
|
||||
#define UNDEF_POS (-1)
|
||||
|
||||
|
@@ -31,6 +31,6 @@ ADD_DEPENDENCIES(mf_iocache-t GenError)
|
||||
MY_ADD_TEST(mf_iocache)
|
||||
|
||||
# Json writer needs String which needs sql library
|
||||
#ADD_EXECUTABLE(my_json_writer-t my_json_writer-t.cc dummy_builtins.cc)
|
||||
#TARGET_LINK_LIBRARIES(my_json_writer-t sql mytap)
|
||||
#MY_ADD_TEST(my_json_writer)
|
||||
ADD_EXECUTABLE(my_json_writer-t my_json_writer-t.cc dummy_builtins.cc)
|
||||
TARGET_LINK_LIBRARIES(my_json_writer-t sql mytap)
|
||||
MY_ADD_TEST(my_json_writer)
|
||||
|
@@ -26,7 +26,6 @@
|
||||
*/
|
||||
|
||||
struct TABLE;
|
||||
struct JOIN_TAB;
|
||||
class Json_writer;
|
||||
|
||||
|
||||
@@ -45,6 +44,10 @@ public:
|
||||
Opt_trace opt_trace;
|
||||
};
|
||||
|
||||
constexpr uint FAKE_SELECT_LEX_ID= UINT_MAX;
|
||||
|
||||
#define sql_print_error printf
|
||||
|
||||
#define JSON_WRITER_UNIT_TEST
|
||||
#include "../sql/my_json_writer.h"
|
||||
#include "../sql/my_json_writer.cc"
|
||||
@@ -131,11 +134,8 @@ int main(int args, char **argv)
|
||||
{
|
||||
Json_writer w;
|
||||
w.start_object();
|
||||
w.add_member("name").add_ll(1);
|
||||
w.start_object();
|
||||
w.add_member("name").start_object();
|
||||
w.add_member("name").add_ll(2);
|
||||
w.end_object();
|
||||
w.end_object();
|
||||
ok(!w.invalid_json, "Valid JSON: nested object member name is the same");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user