Add test to see how many exceptions are during simple use
This commit is contained in:
parent
913d2fd20f
commit
535055eff8
32
samples/test_num_exceptions.cpp
Normal file
32
samples/test_num_exceptions.cpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#include <chaiscript/chaiscript.hpp>
|
||||||
|
#include <chaiscript/chaiscript_stdlib.hpp>
|
||||||
|
#include <chaiscript/dispatchkit/bootstrap_stl.hpp>
|
||||||
|
#include <chaiscript/dispatchkit/function_call.hpp>
|
||||||
|
|
||||||
|
int main( int argc , char * argv[] )
|
||||||
|
{
|
||||||
|
chaiscript::ChaiScript ch( chaiscript::Std_Lib::library( ) );
|
||||||
|
|
||||||
|
static const char script[ ] =
|
||||||
|
R""(
|
||||||
|
|
||||||
|
class Rectangle
|
||||||
|
{
|
||||||
|
def Rectangle() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
var rect = Rectangle( );
|
||||||
|
|
||||||
|
)"";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ch.eval( script );
|
||||||
|
}
|
||||||
|
catch ( std::exception e )
|
||||||
|
{
|
||||||
|
printf( " >>> Exception thrown: %s \n" , e.what( ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user