@@ -872,6 +872,7 @@ struct Returned_Converted_Config
|
||||
};
|
||||
|
||||
|
||||
|
||||
TEST_CASE("Return of converted type from script")
|
||||
{
|
||||
chaiscript::ChaiScript chai;
|
||||
@@ -914,3 +915,27 @@ TEST_CASE("Return of converted type from script")
|
||||
}
|
||||
|
||||
|
||||
int get_value_a(const std::map<std::string, int> &t_m)
|
||||
{
|
||||
return t_m.at("a");
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("Map conversions")
|
||||
{
|
||||
chaiscript::ChaiScript chai;
|
||||
chai.add(chaiscript::map_conversion<std::map<std::string, int>>());
|
||||
chai.add(chaiscript::fun(&get_value_a), "get_value_a");
|
||||
|
||||
const auto c = chai.eval<int>(R"(
|
||||
var m = ["a": 42];
|
||||
get_value_a(m);
|
||||
)");
|
||||
|
||||
CHECK(c == 42);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user