mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-06 16:57:04 +08:00
Make information on source and target types in Type Conversion
Exception public.
This commit is contained in:
parent
eb3ee28cee
commit
a254e11286
@ -1354,7 +1354,7 @@ TEST_CASE("Test ability to get 'use' function from default construction")
|
|||||||
const auto use_function = chai.eval<std::function<chaiscript::Boxed_Value (const std::string &)>>("use");
|
const auto use_function = chai.eval<std::function<chaiscript::Boxed_Value (const std::string &)>>("use");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Throw an exception when trying to add one conversion twice")
|
TEST_CASE("Throw an exception when trying to add same conversion twice")
|
||||||
{
|
{
|
||||||
struct my_int {
|
struct my_int {
|
||||||
int value;
|
int value;
|
||||||
@ -1363,11 +1363,11 @@ TEST_CASE("Throw an exception when trying to add one conversion twice")
|
|||||||
|
|
||||||
chaiscript::ChaiScript chai;
|
chaiscript::ChaiScript chai;
|
||||||
chai.add(chaiscript::type_conversion<int, my_int>([](int x) {
|
chai.add(chaiscript::type_conversion<int, my_int>([](int x) {
|
||||||
std::cout << "Foo type conversion 1\n";
|
std::cout << "My_int type conversion 1\n";
|
||||||
return my_int(x);
|
return my_int(x);
|
||||||
}));
|
}));
|
||||||
CHECK_THROWS_AS(chai.add(chaiscript::type_conversion<int, my_int>([](int x) {
|
CHECK_THROWS_AS(chai.add(chaiscript::type_conversion<int, my_int>([](int x) {
|
||||||
std::cout << "Foo type conversion 2\n";
|
std::cout << "My_int type conversion 2\n";
|
||||||
return my_int(x);
|
return my_int(x);
|
||||||
})), chaiscript::exception::conversion_error);
|
})), chaiscript::exception::conversion_error);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user