Skip to content

Commit 287323e

Browse files
committed
test-case & doc update.
1 parent 6e80bf1 commit 287323e

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ auto cxx_mirror = rtl::CxxMirror({
6666
rtl::type().member<Person>().method("getName").build(Person::getName) // and a getter.
6767
});
6868
```
69-
The `cxx_mirror` object is your gateway to runtime reflection — it lets you query, introspect, and even instantiate types without any compile-time knowledge. It can live anywhere — in any translation unit, quietly sitting in a corner of your codebase. All you need is to expose the `cxx_mirror` wherever reflection is required.
69+
The `cxx_mirror` object is your gateway to runtime reflection — it lets you query, introspect, and even instantiate types without any compile-time knowledge. It can live anywhere — in any translation unit, quietly resting in a corner of your codebase, remaining dormant until first access. All you need is to expose the `cxx_mirror` wherever reflection is required.
7070

7171
And what better way to do that than a **Singleton**:
7272
```c++

RTLTestRunApp/src/FunctionalityTests/TypeErasedReflectiveCalls/BasicTypeErasedDispatch_StaticMethod.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,21 @@ namespace rtl_tests
2525
.returnT<>();
2626
EXPECT_FALSE(reverse_string);
2727
EXPECT_EQ(reverse_string.get_init_error(), rtl::error::InvalidStaticMethodCaller);
28+
29+
auto [err, robj] = reverse_string(StringS())(std::string());
30+
EXPECT_EQ(err, rtl::error::InvalidStaticMethodCaller);
31+
EXPECT_TRUE(robj.isEmpty());
2832
} {
2933
rtl::function<rtl::Return(std::string)> reverse_string = static_cast<rtl::Function>(reverseString.value())
3034
.argsT<std::string>()
3135
.returnT<>();
3236
EXPECT_FALSE(reverse_string);
3337
EXPECT_EQ(reverse_string.get_init_error(), rtl::error::InvalidStaticMethodCaller);
34-
}
38+
39+
auto [err, robj] = reverse_string(std::string());
40+
EXPECT_EQ(err, rtl::error::InvalidStaticMethodCaller);
41+
EXPECT_TRUE(robj.isEmpty());
42+
}
3543
} {
3644
std::optional<rtl::Record> optStringUtil = cxx::mirror().getRecord(StringC::struct_); // doesn't have any static-methods.
3745
ASSERT_TRUE(optStringUtil);
@@ -44,6 +52,10 @@ namespace rtl_tests
4452
.returnT<>();
4553
EXPECT_FALSE(reverse_string);
4654
EXPECT_EQ(reverse_string.get_init_error(), rtl::error::InvalidNonStaticMethodCaller);
55+
56+
auto [err, robj] = reverse_string(std::string());
57+
EXPECT_EQ(err, rtl::error::InvalidNonStaticMethodCaller);
58+
EXPECT_TRUE(robj.isEmpty());
4759
} {
4860
std::optional<rtl::Record> optStringUtil = cxx::mirror().getRecord(StringM::struct_); // doesn't have any static-methods.
4961
ASSERT_TRUE(optStringUtil);
@@ -56,6 +68,10 @@ namespace rtl_tests
5668
.returnT<>();
5769
EXPECT_FALSE(reverse_string);
5870
EXPECT_EQ(reverse_string.get_init_error(), rtl::error::InvalidNonStaticMethodCaller);
71+
72+
auto [err, robj] = reverse_string(std::string());
73+
EXPECT_EQ(err, rtl::error::InvalidNonStaticMethodCaller);
74+
EXPECT_TRUE(robj.isEmpty());
5975
}
6076
}
6177
}

0 commit comments

Comments
 (0)