File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < gtest/gtest.h>
2
+
3
+ #include < functional>
4
+ #include < iostream>
5
+ #include < rfl.hpp>
6
+ #include < rfl/json.hpp>
7
+ #include < string_view>
8
+
9
+ namespace test_string_view {
10
+
11
+ struct TestStruct {
12
+ std::string_view name;
13
+ };
14
+
15
+ TEST (json, test_string_view) {
16
+ const std::string name = " Homer Simpson" ;
17
+ const auto test_struct = TestStruct{.name = name};
18
+
19
+ const auto json_string = rfl::json::write (test_struct);
20
+ const std::string expected = R"( {"name":"Homer Simpson"})" ;
21
+ EXPECT_EQ (json_string, expected)
22
+ << " Test failed on write. Expected:" << std::endl
23
+ << expected << std::endl
24
+ << " Got: " << std::endl
25
+ << json_string << std::endl
26
+ << std::endl;
27
+ }
28
+ } // namespace test_string_view
You can’t perform that action at this time.
0 commit comments