Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
fb9a2643
Commit
fb9a2643
authored
Oct 30, 2019
by
Anthony Van Herrewege
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for #1647.
parent
27d0dfc1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
unit-conversions.cpp
test/src/unit-conversions.cpp
+25
-0
No files found.
test/src/unit-conversions.cpp
View file @
fb9a2643
...
...
@@ -1537,6 +1537,31 @@ NLOHMANN_JSON_SERIALIZE_ENUM(TaskState,
{
TS_COMPLETED
,
"completed"
},
})
namespace
{
// Helper struct to test whether compile error does not trigger upon
// conversion of an enum in the presence of non-member operator== for
// user-defined type with "non default" from_json function (#1647).
struct
NonDefaultFromJsonStruct
{
};
inline
bool
operator
==
(
NonDefaultFromJsonStruct
const
&
lhs
,
NonDefaultFromJsonStruct
const
&
rhs
)
{
return
true
;
}
}
namespace
nlohmann
{
template
<>
struct
adl_serializer
<
NonDefaultFromJsonStruct
>
{
static
NonDefaultFromJsonStruct
from_json
(
json
const
&
j
)
{
return
{};
}
};
}
TEST_CASE
(
"JSON to enum mapping"
)
{
SECTION
(
"enum class"
)
...
...
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