Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
c9fcea14
Commit
c9fcea14
authored
Dec 15, 2021
by
Sergei Krivonos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-27036: re-enable my_json_writer-t unit test
parent
6208228b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
17 deletions
+17
-17
sql/my_json_writer.cc
sql/my_json_writer.cc
+1
-4
sql/my_json_writer.h
sql/my_json_writer.h
+6
-4
sql/sql_explain.h
sql/sql_explain.h
+0
-1
sql/sql_priv.h
sql/sql_priv.h
+2
-0
unittest/sql/CMakeLists.txt
unittest/sql/CMakeLists.txt
+3
-3
unittest/sql/my_json_writer-t.cc
unittest/sql/my_json_writer-t.cc
+5
-5
No files found.
sql/my_json_writer.cc
View file @
c9fcea14
...
...
@@ -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
{
...
...
sql/my_json_writer.h
View file @
c9fcea14
...
...
@@ -17,7 +17,7 @@
#define JSON_WRITER_INCLUDED
#include "my_base.h"
#include "sql_s
elect
.h"
#include "sql_s
tring
.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
...
...
sql/sql_explain.h
View file @
c9fcea14
...
...
@@ -74,7 +74,6 @@ class Json_writer;
*************************************************************************************/
const
uint
FAKE_SELECT_LEX_ID
=
UINT_MAX
;
class
Explain_query
;
...
...
sql/sql_priv.h
View file @
c9fcea14
...
...
@@ -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)
...
...
unittest/sql/CMakeLists.txt
View file @
c9fcea14
...
...
@@ -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
)
unittest/sql/my_json_writer-t.cc
View file @
c9fcea14
...
...
@@ -26,7 +26,6 @@
*/
struct
TABLE
;
struct
JOIN_TAB
;
class
Json_writer
;
...
...
@@ -45,6 +44,10 @@ class THD
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"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment