Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
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
Libraries
json
Commits
5d511a6e
Commit
5d511a6e
authored
Mar 27, 2019
by
onqtam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed a bunch of warnings from the Makefile from the root of the repo
parent
82af0ecd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
16 deletions
+48
-16
Makefile
Makefile
+2
-0
test/src/unit-allocator.cpp
test/src/unit-allocator.cpp
+11
-11
test/src/unit-regression.cpp
test/src/unit-regression.cpp
+1
-1
test/src/unit-testsuites.cpp
test/src/unit-testsuites.cpp
+2
-2
test/thirdparty/doctest/doctest.h
test/thirdparty/doctest/doctest.h
+9
-2
test/thirdparty/doctest/doctest_compatibility.h
test/thirdparty/doctest/doctest_compatibility.h
+23
-0
No files found.
Makefile
View file @
5d511a6e
...
...
@@ -116,6 +116,7 @@ doctest:
# calling Clang with all warnings, except:
# -Wno-documentation-unknown-command: code uses user-defined commands like @complexity
# -Wno-exit-time-destructors: warning in json code triggered by NLOHMANN_JSON_SERIALIZE_ENUM
# -Wno-keyword-macro: unit-tests use "#define private public"
# -Wno-deprecated-declarations: the library deprecated some functions
# -Wno-weak-vtables: exception class is defined inline, but has virtual method
...
...
@@ -130,6 +131,7 @@ pedantic_clang:
-Werror
\
-Weverything
\
-Wno-documentation-unknown-command
\
-Wno-exit-time-destructors
\
-Wno-keyword-macro
\
-Wno-deprecated-declarations
\
-Wno-weak-vtables
\
...
...
test/src/unit-allocator.cpp
View file @
5d511a6e
...
...
@@ -61,7 +61,7 @@ TEST_CASE("bad_alloc")
bad_allocator
>
;
// creating an object should throw
CHECK_THROWS_AS
(
auto
tmp
=
bad_json
(
bad_json
::
value_t
::
object
),
std
::
bad_alloc
&
);
CHECK_THROWS_AS
(
bad_json
(
bad_json
::
value_t
::
object
),
std
::
bad_alloc
&
);
}
}
...
...
@@ -153,7 +153,7 @@ TEST_CASE("controlled bad_alloc")
auto
t
=
my_json
::
value_t
::
object
;
CHECK_NOTHROW
(
my_allocator_clean_up
(
my_json
::
json_value
(
t
).
object
));
next_construct_fails
=
true
;
CHECK_THROWS_AS
(
auto
tmp
=
my_json
::
json_value
(
t
),
std
::
bad_alloc
&
);
CHECK_THROWS_AS
(
my_json
::
json_value
(
t
),
std
::
bad_alloc
&
);
next_construct_fails
=
false
;
}
SECTION
(
"array"
)
...
...
@@ -162,7 +162,7 @@ TEST_CASE("controlled bad_alloc")
auto
t
=
my_json
::
value_t
::
array
;
CHECK_NOTHROW
(
my_allocator_clean_up
(
my_json
::
json_value
(
t
).
array
));
next_construct_fails
=
true
;
CHECK_THROWS_AS
(
auto
tmp
=
my_json
::
json_value
(
t
),
std
::
bad_alloc
&
);
CHECK_THROWS_AS
(
my_json
::
json_value
(
t
),
std
::
bad_alloc
&
);
next_construct_fails
=
false
;
}
SECTION
(
"string"
)
...
...
@@ -171,7 +171,7 @@ TEST_CASE("controlled bad_alloc")
auto
t
=
my_json
::
value_t
::
string
;
CHECK_NOTHROW
(
my_allocator_clean_up
(
my_json
::
json_value
(
t
).
string
));
next_construct_fails
=
true
;
CHECK_THROWS_AS
(
auto
tmp
=
my_json
::
json_value
(
t
),
std
::
bad_alloc
&
);
CHECK_THROWS_AS
(
my_json
::
json_value
(
t
),
std
::
bad_alloc
&
);
next_construct_fails
=
false
;
}
}
...
...
@@ -182,7 +182,7 @@ TEST_CASE("controlled bad_alloc")
my_json
::
string_t
v
(
"foo"
);
CHECK_NOTHROW
(
my_allocator_clean_up
(
my_json
::
json_value
(
v
).
string
));
next_construct_fails
=
true
;
CHECK_THROWS_AS
(
auto
tmp
=
my_json
::
json_value
(
v
),
std
::
bad_alloc
&
);
CHECK_THROWS_AS
(
my_json
::
json_value
(
v
),
std
::
bad_alloc
&
);
next_construct_fails
=
false
;
}
}
...
...
@@ -193,9 +193,9 @@ TEST_CASE("controlled bad_alloc")
{
next_construct_fails
=
false
;
std
::
map
<
std
::
string
,
std
::
string
>
v
{{
"foo"
,
"bar"
}};
CHECK_NOTHROW
(
auto
tmp
=
my_json
(
v
));
CHECK_NOTHROW
(
my_json
(
v
));
next_construct_fails
=
true
;
CHECK_THROWS_AS
(
auto
tmp
=
my_json
(
v
),
std
::
bad_alloc
&
);
CHECK_THROWS_AS
(
my_json
(
v
),
std
::
bad_alloc
&
);
next_construct_fails
=
false
;
}
...
...
@@ -203,9 +203,9 @@ TEST_CASE("controlled bad_alloc")
{
next_construct_fails
=
false
;
std
::
vector
<
std
::
string
>
v
{
"foo"
,
"bar"
,
"baz"
};
CHECK_NOTHROW
(
auto
tmp
=
my_json
(
v
));
CHECK_NOTHROW
(
my_json
(
v
));
next_construct_fails
=
true
;
CHECK_THROWS_AS
(
auto
tmp
=
my_json
(
v
),
std
::
bad_alloc
&
);
CHECK_THROWS_AS
(
my_json
(
v
),
std
::
bad_alloc
&
);
next_construct_fails
=
false
;
}
...
...
@@ -222,9 +222,9 @@ TEST_CASE("controlled bad_alloc")
{
next_construct_fails
=
false
;
std
::
string
s
(
"foo"
);
CHECK_NOTHROW
(
auto
tmp
=
my_json
(
s
));
CHECK_NOTHROW
(
my_json
(
s
));
next_construct_fails
=
true
;
CHECK_THROWS_AS
(
auto
tmp
=
my_json
(
s
),
std
::
bad_alloc
&
);
CHECK_THROWS_AS
(
my_json
(
s
),
std
::
bad_alloc
&
);
next_construct_fails
=
false
;
}
}
...
...
test/src/unit-regression.cpp
View file @
5d511a6e
...
...
@@ -292,7 +292,7 @@ TEST_CASE("regression tests")
int
number
=
j
[
"Number"
];
CHECK
(
number
==
100
);
float
foo
=
j
[
"Foo"
];
CHECK
(
foo
==
Approx
(
42.42
));
CHECK
(
static_cast
<
double
>
(
foo
)
==
Approx
(
42.42
));
}
SECTION
(
"issue #89 - nonstandard integer type"
)
...
...
test/src/unit-testsuites.cpp
View file @
5d511a6e
...
...
@@ -457,7 +457,7 @@ TEST_CASE("RFC 7159 examples")
}
)"
;
CHECK_NOTHROW
(
auto
tmp
=
json
(
json_contents
));
CHECK_NOTHROW
(
json
(
json_contents
));
}
{
...
...
@@ -484,7 +484,7 @@ TEST_CASE("RFC 7159 examples")
"Country": "US"
}
])"
;
CHECK_NOTHROW
(
auto
tmp
=
json
(
json_contents
));
CHECK_NOTHROW
(
json
(
json_contents
));
}
CHECK
(
json
::
parse
(
"
\"
Hello world!
\"
"
)
==
json
(
"Hello world!"
));
...
...
test/thirdparty/doctest/doctest.h
View file @
5d511a6e
...
...
@@ -160,6 +160,7 @@ DOCTEST_GCC_SUPPRESS_WARNING("-Wnon-virtual-dtor")
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Winline"
)
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wunused-local-typedefs"
)
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wuseless-cast"
)
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wnoexcept"
)
DOCTEST_MSVC_SUPPRESS_WARNING_PUSH
DOCTEST_MSVC_SUPPRESS_WARNING
(
4616
)
// invalid compiler warning
...
...
@@ -1599,7 +1600,7 @@ namespace detail {
~
ContextScope
();
void
stringify
(
std
::
ostream
*
s
)
const
;
void
stringify
(
std
::
ostream
*
s
)
const
override
;
};
struct
DOCTEST_INTERFACE
MessageBuilder
:
public
MessageData
...
...
@@ -2722,6 +2723,9 @@ DOCTEST_GCC_SUPPRESS_WARNING("-Wold-style-cast")
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wunused-local-typedefs"
)
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wuseless-cast"
)
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wunused-function"
)
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wmultiple-inheritance"
)
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wnoexcept"
)
DOCTEST_GCC_SUPPRESS_WARNING
(
"-Wsuggest-attribute"
)
DOCTEST_MSVC_SUPPRESS_WARNING_PUSH
DOCTEST_MSVC_SUPPRESS_WARNING
(
4616
)
// invalid compiler warning
...
...
@@ -3836,6 +3840,7 @@ namespace {
if
(
curr
->
translate
(
res
))
return
res
;
// clang-format off
DOCTEST_GCC_SUPPRESS_WARNING_WITH_PUSH
(
"-Wcatch-value"
)
try
{
throw
;
}
catch
(
std
::
exception
&
ex
)
{
...
...
@@ -3847,6 +3852,7 @@ namespace {
}
catch
(...)
{
return
"unknown exception"
;
}
DOCTEST_GCC_SUPPRESS_WARNING_POP
// clang-format on
#else // DOCTEST_CONFIG_NO_EXCEPTIONS
return
""
;
...
...
@@ -4872,6 +4878,7 @@ namespace {
.
writeAttribute
(
"name"
,
in
.
m_name
)
.
writeAttribute
(
"filename"
,
skipPathFromFilename
(
in
.
m_file
))
.
writeAttribute
(
"line"
,
line
(
in
.
m_line
));
xml
.
ensureTagClosed
();
}
void
subcase_end
()
override
{
xml
.
endElement
();
}
...
...
@@ -5997,4 +6004,4 @@ DOCTEST_MSVC_SUPPRESS_WARNING_POP
DOCTEST_GCC_SUPPRESS_WARNING_POP
#endif // DOCTEST_LIBRARY_IMPLEMENTATION
#endif // DOCTEST_CONFIG_IMPLEMENT
\ No newline at end of file
#endif // DOCTEST_CONFIG_IMPLEMENT
test/thirdparty/doctest/doctest_compatibility.h
View file @
5d511a6e
...
...
@@ -25,6 +25,29 @@
#define CHECK_THROWS_WITH_STD_STR(expr, str) \
CHECK_THROWS_WITH_STD_STR_IMPL(expr, str, DOCTEST_ANONYMOUS(DOCTEST_STD_STRING_))
#undef CHECK_THROWS
#undef CHECK_THROWS_AS
#undef CHECK_THROWS_WITH
#undef CHECK_NOTHROW
#undef REQUIRE_THROWS
#undef REQUIRE_THROWS_AS
#undef REQUIRE_THROWS_WITH
#undef REQUIRE_NOTHROW
// doctest allows multiple statements in these macros (even blocks of code) but json
// tests rely on passing single function/constructor calls which have a [[nodiscard]]
// attribute so here we static_cast to void - just like Catch does
#define CHECK_THROWS(expr) DOCTEST_CHECK_THROWS(static_cast<void>(expr))
#define CHECK_THROWS_AS(expr, e) DOCTEST_CHECK_THROWS_AS(static_cast<void>(expr), e)
#define CHECK_THROWS_WITH(expr, e) DOCTEST_CHECK_THROWS_WITH(static_cast<void>(expr), e)
#define CHECK_NOTHROW(expr) DOCTEST_CHECK_NOTHROW(static_cast<void>(expr))
#define REQUIRE_THROWS(expr) DOCTEST_REQUIRE_THROWS(static_cast<void>(expr))
#define REQUIRE_THROWS_AS(expr, e) DOCTEST_REQUIRE_THROWS_AS(static_cast<void>(expr), e)
#define REQUIRE_THROWS_WITH(expr, e) DOCTEST_REQUIRE_THROWS_WITH(static_cast<void>(expr), e)
#define REQUIRE_NOTHROW(expr) DOCTEST_REQUIRE_NOTHROW(static_cast<void>(expr))
// included here because for some tests in the json repository private is defined as
// public and if no STL header is included before that then in the json include when STL
// stuff is included the MSVC STL complains (errors) that C++ keywords are being redefined
...
...
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