File tree Expand file tree Collapse file tree 3 files changed +48
-3
lines changed
Expand file tree Collapse file tree 3 files changed +48
-3
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "$schema" : " https://puremourning.github.io/vimspector/schema/vimspector.schema.json#" ,
3+ "configurations" : {
4+ "test-clang" : {
5+ "adapter" : " vscode-cpptools" ,
6+ "configuration" : {
7+ "request" : " launch" ,
8+ "program" : " ${workspaceRoot}/out/build/linux-clang-debug/test-reflection-cpp" ,
9+ "args" : [
10+ ],
11+ "cwd" : " ${workspaceRoot}" ,
12+ "externalConsole" : true ,
13+ "stopAtEntry" : false ,
14+ "MIMode" : " gdb"
15+ },
16+ "breakpoints" : {
17+ "exception" : {
18+ "caught" : " Y" ,
19+ "uncaught" : " Y"
20+ }
21+ }
22+ }
23+ }
24+ }
Original file line number Diff line number Diff line change @@ -383,8 +383,9 @@ consteval auto GetName()
383383 return str.substr (0 , str.find (' >' ));
384384#else
385385 std::string_view str = REFLECTION_PRETTY_FUNCTION;
386- str = str.substr (str.rfind (" ::" ) + 2 );
387- return str.substr (0 , str.find (' ]' ));
386+ str = str.substr (str.rfind (" ::" ) + 2 + 15 );
387+ str = str.substr (0 , str.find (' ]' ));
388+ return str;
388389#endif
389390}
390391
Original file line number Diff line number Diff line change @@ -28,9 +28,29 @@ std::string inspect(Object const& object)
2828 }(std::make_index_sequence<Reflection::CountMembers<Object>> {});
2929}
3030
31+ enum Color
32+ {
33+ Red,
34+ Green,
35+ Blue
36+ };
37+
38+ TEST_CASE (" GetName" , " [reflection]" )
39+ {
40+ auto const enumValue = Reflection::GetName<Color::Red>();
41+ CHECK (enumValue == " Red" );
42+
43+ auto const enumValue2 = Reflection::GetName<Color::Green>();
44+ CHECK (enumValue2 == " Green" );
45+
46+ auto const person = Person {
" John Doe" ,
" [email protected] " ,
42 };
47+ auto const memberName1 = Reflection::GetName<&Person::email>();
48+ CHECK (memberName1 == " email" );
49+ }
50+
3151TEST_CASE (" core" , " [reflection]" )
3252{
33- auto p = Person { " John Doe" , " jon @doe.com" , 42 };
53+ auto p = Person { " John Doe" , " john @doe.com" , 42 };
3454 std::cout << " Elements: " << Reflection::CountMembers<Person> << ' \n ' ;
3555 std::cout << inspect (p);
3656
You can’t perform that action at this time.
0 commit comments